matlab

Call two Matlab functions simultaneously from .net

I am writing a C# application and I would like to make calls to different matlab functions simultaneously(from different threads). Each Matlab function is located in its own compiled .net library. It seems that I am only able to call one Matlab function at a time however. ie, if matlab_func1() gets called from thread1 then matlab_func2...

How to convert a grayscale matrix to an RGB matrix in MATLAB?

rgbImage = grayImage / max(max(grayImage)); or rgbImage = grayImage / 255; Which of the above is right,and reason? ...

Need help understanding several MATLAB statement

All are from this post. What does these statement mean: error(nargchk(5, 6, nargin)); plot(p(:,1), p(:,2), '.-'), axis equal And what's this kinda syntax which I haven't quite often seen: if nargin<6, steps = 36; end ...

Matlab neural network relay modeling

Did anyone try to train a net to act as a relay ? Can't get it working, using nntool and simple train model like chirp -> relay -> out. Apreciate your help. ...

Matlab multiple graph types inside one graph

Hi, I have a task to draw electrostatic field between two electrodes( at given sizes and shape ), what i have now is that i draw the electrodes with area plot (area(elect_x,elect_y)) the graph looks like this: ------------------.--- |.. .---. |.. |...| |.. .----....| |.. |........| ...

Does white color has a fixed value(1 IMO) in an RGB image in MATLAB?

Or say does 1 denotes white for an RGB image? I have this question because of this answer: http://stackoverflow.com/questions/2619668/how-to-convert-a-grayscale-matrix-to-an-rgb-matrix-in-matlab/2619714#2619714 Can someone clarify it? ...

How can I change the tick marks scale in MATLAB?

Hey, I have a matrix A which I am plotting using imagesc(A). The matrix is a 512 X 512 matrix, but I need the axes to be labeled from 0 to 4000 instead of 0 to 512. I can't seem to find where I can change this instead of just changing from where to where the points are plotted! ...

How to convert the integer date format into YYYYMMDD?

Python and Matlab quite often have integer date representations as follows: 733828.0 733829.0 733832.0 733833.0 733834.0 733835.0 733836.0 733839.0 733840.0 733841.0 these numbers correspond to some dates this year. Do you guys know which function can convert them back to YYYYMMDD format? thanks a million! ...

Replace empty cells with logical 0's before cell2mat in MATLAB

I've got a cell array of empty cells and ones that I want to convert to a logical array, where the empty cells are zeros. When I use cell2mat, the empty cells are ignored, and I end up with a matrix of solely 1's, with no reference to the previous index they held. Is there a way to perform this operation without using loops? Example cod...

Convert cell array of cells into cell array of strings in MATLAB

Using regexp with tokens on cell array of strings I've got cell array of cells. Here is simplified example: S = {'string 1';'string 2';'string 3'}; res = regexp(S,'(\d)','tokens') res = {1x1 cell} {1x1 cell} {1x1 cell} res{2}{1} ans = '2' I know I have only one match per cell string in S. How I can convert this outp...

BMP2AVI program in matlab

HI I wrote a program that use to work (swear to god) and has stopped from working. this code takes a series of BMPs and convert them into avi file. this is the code: path4avi='C:/FadeOutMask/'; %dont forget the '/' in the end of the path pathOfFrames='C:/FadeOutMask/'; NumberOfFiles=1; NumberOfFrames=10; %1:1:(NumberOfFiles) for i=...

How to pass function to radio button in a button group created using guide in MATLAB?

I have created a button group with four radio buttons and a push button using guide. There are four functions, one for each radio button written separately. How do you to call these functions from respective radio buttons. When a push button is pressed, the function associated with the active radio button should execute. ...

Growable data structure in MATLAB

I need to create a queue in matlab that holds structs which are very large. I don't know how large this queue will get. Matlab doesn't have linked lists, and I'm worried that repeated allocation and copying is really going to slow down this code which must be run thousands of times. I need some sort of way to use a growable data structur...

Running multiprocess applications from MATLAB

I've written a multitprocess application in VC++ and tried to execute it with command line arguments with the system command from MATLAB. It runs, but only on one core --- any suggestions? Update:In fact, it doesn't even see the second core. I used OpenMP and used omp_get_max_threads() and omp_get_thread_num() to check and omp_get_max_t...

How to convert a web page into an image using MATLAB?

This task is very hard to finish in other programming languages, what about in MATLAB? ...

Matlab: how to find functions on path that use a given function

It sometimes happens that I need to change the behavior of a function. Is there an easy way to find functions (on the matlab path) that use that function? ...

How to deal with the warnings when importing BNT tools in MATLAB?

I'm following the steps: http://code.google.com/p/bnt/wiki/HowToInstall But only to get a lot of warnings: >> addpath(genpathKPM(pwd)) Warning: Function D:\MATLAB\R2007b\toolbox\FullBNT-1.0.4\KPMtools\assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. > In path at 110...

How can I flush the output of disp in Matlab or Octave?

I have a program in Octave that has a loop - running a function with various parameters, not something that I can turn into matrices. At the beginning of each iteration I print the current parameters using disp. The first times I ran it I had a brazillion warnings, and then I also got these prints. Now that I cleaned them up, I no l...

How do you write multiple lists from Matlab to the same excel file?

I have several lists in Matlab that I want to write to the same excel file. I have one list xordered and another list aspl. I do not know the length of the lists till after I run the Matlab program. I used data = xlswrite('edgar.xls',fliplr(sortedx'),'A2:A3000') for the first list but when I tried to write another list to the same ...

How can I find the maximum or minimum of a multi-dimensional matrix in MATLAB?

I have a 4D array of measurements in MATLAB. Each dimension represents a different parameter for the measurement. I want to find the maximum and minimum value and the index (i.e. which parameter) of each. What's the best way to do it? I figure I can take the max of the max of the max in each dimension, but that seems like a kludge. ...