Matlab Matrix Initialization
Matlab Matrix Initialization
(OP)
Hi,
I am a newbie in matlab. I am trying to initialize an empty matrix with certain dimensions.
X = 1:5;
Y = 1:1;
[X, Y] = ndgrid(x, y);
tabuList = [X,Y];
for i = 1:5
tabuList(i,1) = 'EMPTY';
endHowever, I get the following error
I m not sure why it is not recognizing x and y. Can some let me know of the proper initialization technique.
I am a newbie in matlab. I am trying to initialize an empty matrix with certain dimensions.
CODE
X = 1:5;
Y = 1:1;
[X, Y] = ndgrid(x, y);
tabuList = [X,Y];
for i = 1:5
tabuList(i,1) = 'EMPTY';
end
CODE
??? Undefined function or variable 'x'.
I m not sure why it is not recognizing x and y. Can some let me know of the proper initialization technique.





RE: Matlab Matrix Initialization
[X, Y] = ndgrid(X, Y);
I think the problem is that MATLAB is looking for the variable 'x', whereas you've initiated 'X' (remember MATLAB is case sensitive).
RE: Matlab Matrix Initialization
- Steve
RE: Matlab Matrix Initialization
ndgrid=zeros(m,n);
% here m, and n are the dimensions of the empty matrix directly
Fe
RE: Matlab Matrix Initialization