matlab

Match overlapping patterns with capture using a MATLAB regular expression

I'm trying to parse a log file that looks like this: %%%% 09-May-2009 04:10:29 % Starting foo this is stuff to ignore %%%% 09-May-2009 04:10:50 % Starting bar more stuff to ignore %%%% 09-May-2009 04:11:29 ... This excerpt contains two time periods I'd like to extract, from the first delimiter to the second, and from the second to the...

How do you get the size of a file in MATLAB?

What is the best way to figure out the size of a file using MATLAB? The first thought that comes to mind is size(fread(fid)). ...

running old mex file on new matlab releases

I'm trying to run a program originally tested on Matlab 6.5 on a new release (R2009a) The program uses some mex files, and I get the following error when trying to run it: ??? Invalid MEX-file '/normalizedCut/common_files/sparsifyc.mexglx': normalizedCut/common_files/sparsifyc.mexglx: symbol mxGetIr, version libmx.INTERNAL not defined i...

Order of method invocation

Hi everybody I write java class with the main method and I invoke method from matlab which takes long time and the program run other method which takes less time before the method of matlab. I want to run the method from matlab to be execute first then I want the other method to execute so can you help me please Thanks ...

Detect matlab processes from within matlab

Is there any way of detecting how many matlab processes are running on a computer from within a matlab program? I would like to have exactly n matlab processes running. If I have too few I want to create them and if I have to many I want to kill some. You can of course do this manually, but I'd prefer to have it automatic if it is possi...

How to get the memory address of the Java heap?

How can I determine the address in memory of the Java heap for a JVM running in the current process? That is, get a void* pointer or equivalent to the contiguous area of memory that the JVM has allocated for the heap, using Java, C, or other calls? Matlab has a JVM embedded in its process. The memory the JVM allocates is unavailable for...

matlab Bucketing Algorithm Help

I've got some code that works, but is a bit of a bottleneck, and I'm stuck trying to figure out how to speed it up. It's in a loop, and I can't figure how to vectorize it. I've got a 2D array, vals, that represents timeseries data. Rows are dates, columns are different series. I'm trying to bucket the data by months to perform variou...

How to determine where a number is printing from in MATLAB?

In MATLAB, how do you tell where in the code a variable is getting output? I have about 10K lines of MATLAB code with about 4 people working on it. Somewhere, someone has dumped a variable in a MATLAB script in the typical way: foo Unfortunately, I do not know what variable is getting output. And the output is cluttering out other mo...

Unwanted overwriting of duplicates in a PARFOR loop

In MATLAB, the first set of loops below accounts for duplicates, but the second set of loops (using PARFOR) does not. They overwrite the previous value. How do we fix that? For loop: for d = 1:length(set), for k = 1:length(dset), if strcmp(pset(k),set(d)), t(h,p) = dset(k); h = h+1; end end end PARFOR loop: p...

Sharing memory between processes [matlab]

Is there any way to share memory between matlab processes on the same computer? I am running several matlab processes on a multi-core computer (running windowsif it matters). They all use the same gigantic input data. It would be nice to only have a single copy of it in memory. Edit: Unfortunately each process needs access to the who...

Simplest way to send messages between Matlab, VB6 and VB.NET programs

We are upgrading a suite of data acquisition and analysis routines from VB6 programs to a mixture of VB.NET, VB6, and Matlab programs. We want to keep the system modular (separate EXEs) so we can easily create specialized stand-alone analysis programs without having to constantly upgrade one massive application. We have used MBInterPro...

Read .mat files in Python

Does anyone have successful experience reading binary Matlab .mat files in Python? (I've seen that scipy has alleged support for reading .mat files, but I'm unsuccessful with it. I installed scipy version 0.7.0, and I can't find the loadmat() method) ...

Scripts to documents (Matlab's publish functionality in python)

Matlab has this great tool called publish. This tool converts a regular matlab script with minimal formatting stuff into structured, nice looking reports (HTML, LateX, RTF). It is capable of handling graphics, mathematical formulae etc. Is there a similar tool for Python? ...

Count struct properties in MATLAB

I have a function that returns one or more variables, but as it changes (depending on whether the function is successfull or not), the following does NOT work: [resultA, resultB, resultC, resultD, resultE, resultF] = func(somevars); This will sometimes return an error, varargout{2} not defined, since only the first variable resultA is...

How to solve symbolic equation with double coefficients in matlab?

I have quadratic equation 1/x = 1/(a-x) + 1/(3*a -x) I want to solve it in matlab: solve('1/x=1/(a-x)+1/(3*a-x)', 'x') ans = (4/3+1/3*7^(1/2))*a (4/3-1/3*7^(1/2))*a Is there any way to solve equation with float coefficient? Like ans = 2.215250437021530*a 0.451416229645136*a ...

Machine vision in Python

I would like to perform a few basic machine vision tasks using Python and I'd like to know where I could find tutorials to help me get started. As far as I know, the only free library for Python that does machine vision is PyCV (which is a wrapper for OpenCV apparently), but I can't find any appropriate tutorials. My main tasks are to ...

Using Matlab & Simulink models in .NET

Hi, I am creating a quite complex digital filter in Simulink. For testing I generate a .txt file i .NET application and use this file as a source in Simulink model. Does anyone know whether it is possible to generate a Simulink model, define input and output and then connect it with .NET application? ...

Value of uninitialized persistent variable in MATLAB

If I declare a variable as 'persistent' in MATLAB, how can I check if it has been initialized or not? The exist() function apparently doesn't work (as the variable is treated as in existence as soon as I declare it to be persistent). ...

RLS Cost Function - Slow Computation MATLAB

Dear, I creat a simulation adaptive noise cancellation using RLS algorithm, I use matlab 7.6 toolbox (adaptfilt.rls) to perform adaptive filtering, This is the matlab m file that I made, i modify the matlab m file located on "C:\Program Files\MATLAB\R2008a\toolbox\filterdesign\filterdesign\@adaptfilt\@rls\thisfilter.m", by adding the ca...

MATLAB: Extract multiple parts of a matrix without using loops

Hi, I have a huge 2D matrix and I would like to extract 15 different 100x100 parts out of it. I have two vectors x and y where the top left indices of the parts are saved. I have used something like this: result = cam1(x(1:end):(x(1:end)+99), y(1:end):(y(1:end)+99)); but the result is just a 100x100 matrix instead of a 15x100x100. Wh...