Possible Duplicate:
How do you concatenate the rows of a matrix into a vector in MATLAB?
Hi,
Does anyone know what is the best way to create one row matrix (vector) from M x N matrix by putting all rows, from 1 to M, of the original matrix into first row of new matrix the following way:
A = [row1; row2, ..., rowM]
B = [row1,...
How can I see a list of what global variables are defined in MATLAB? (I am using R2009a).
I have hunted unfruitfully for this on Google and SO, so apologies if it has been asked before.
...
Given a structure array, how do I rename a field? For example, given the following, how do I change "bar" to "baz".
clear
a(1).foo = 1;
a(1).bar = 'one';
a(2).foo = 2;
a(2).bar = 'two';
a(3).foo = 3;
a(3).bar = 'three';
disp(a)
What is the best method, where "best" is a balance of performance, clarity, and generality?
...
How do you use MatLab to calculate the SNR?
Update
I only have one file, not two like in the example and it's a .tif.
...
Dear all,
Does anyone have some advise how to read a comma separated data file into matlab? The simple solutions (like dlmread, fscanf) do not seem to work, as there are multiple (10) lines of header information. The closest I got to a solution is:
C=textscan(datafile)
G=cell2mat(C{1,1}(34:endoffile)}) //34 is the line the data starts
...
Hello I'm creating a GUI and I want the "Edit text" button to display the name of the file I selected....i've stored the filename and the pathname in a variable called "File_Selected:....but how do i pass the filename only to the EditText function on my GUI
...
This seems to be a very common problem of mine:
data = [1 2 3; 4 5 6];
mask = [true false true];
mask = repmat(mask, 2, 1);
data(mask) ==> [1; 4; 3; 6]
What I wanted was [1 3; 4 6].
Yes I can just reshape it to the right size, but that seems the wrong way to do it. Is there a better way? Why doesn't data(mask) return a matrix whe...
When dealing with cell arrays, I can use the deal() function to assign cells to output variables, such as:
[a, b, c] = deal(myCell{:});
or just:
[a, b, c] = myCell{:};
I would like to do the same thing for a simple array, such as:
myArray = [1, 2, 3];
[a, b, c] = deal(myArray(:));
But this doesn't work. What's the alternative?
...
Hello everyone. The setup I have is I'm using a Java application to call native C-code with JNI, which in turn starts up the MATLAB runtime and calls functions on it (I know there are other solutions to call MATLAB methods from Java).
The problem is that the MATLAB engine crashes at some point during the initialization and I don't know...
Dears. I am using Matlab 2009b and having an out of memory error. I read other posted sol but they are not useful for me. I am sure that i am doing things right but i must use very huge amount of array sizes. I think that the problem lies beyond the fact that Matlab does not enable an array to be in more than one OS block. I am using Win...
Is it possible to compare the color of two images using Matlab if the two images are of different sizes?The problem that am facing is that, i want to detect the presence of a colored patch in an image?
...
How do you plot a Bessel function (2d) of the 1st kind in Matlab?
...
We have a lot of MATLAB code in my lab. The problem is there's really no way to organize it. Since all the functions have to be in the same folder to be called (or you have to add a bunch of folders to MATLAB's path environment variable), it seems that we're doomed have loads of files in the same folder, all in the global namespace. Is t...
How can I modify this program using load-ascii command to read (x,y)?
n=0;
sum_x = 0;
sum_y = 0;
sum_x2 = 0;
sum_xy = 0;
disp('This program performs a least-squares fit of an');
disp('input data set to a straight line. Enter the name');
disp('of the file containing the input (x,y) pairs: ');
filename = input(' ','s');
[fid,msg] = fop...
What would be matlab's equivalent of
write(1,'("Speed, resistance, power",3f8.2)')(a(i),i=1,3)
I've tried
a = [10. 20. 200.]
fprintf(unit1,'a = 3%8.1e',a)
but I'm still having trouble with it (the whole matlab output formatting thing).
Edit for Kenny: for the values of a as given above, it would give (in a new row):
Speed, res...
Hello, I just implemented a SOM algorithm in MATLAB that outputs component planes and U matrix....but i want to be able to calculate sensitivity, accuracy and specificity....how do i go about doing this in MATLAB??....any ideas or useful links would be highly appreciated??
...
i have got the following fraction of code that getting me the stack overflow error
#pragma omp parallel shared(Mo1, Mo2, sum_normalized_p_gn, Data, Mean_Out,Covar_Out,Prior_Out, det) private(i) num_threads( number_threads )
{
//every thread has a new copy
double* normalized_p_gn = (double*)malloc(NMIX*sizeof(dou...
Hello,
I'm a matlab newbie, and i'd like to superpose some hist fit on a same figure.
I know the function histfit, but unfortunatly i can't get to remove the hist and only keep the curve.
I guess once i'll know how to do that i'll be able to add several curves using "hold on".
Thanx for any answers or advices!
...
I have a 1 by N double array consisting of 1 and 0. I would like to map all the 1 to symbol '-3' and '3' and all the 0 to symbol '-1' and '1' equally. Below is my code. As my array is approx 1 by 8 million, it is taking a very long time. How to speed things up?
[row,ll] = size(Data);
sym_zero = -1;
sym_one = -3;
for loop = 1 : row
i...
I'm working on a robot localization simulator and I created a class called "landmark".
The end result is going to be a robot that is always centered and always faces the top of the screen. As it turns, the birds eye view map will rotate around the robot. To accomplish this, I'm assuming I can rotate one class and have all elements i...