cubearth
cubearth

Reputation: 1153

the function and use of cell(m,n) in matlab

I was reading that in MatLab, if you are going to fill a larger matrix, its more computational efficient to declare it's size from before with the use of the cell command; E.g.

X = cell(500,90);

but when I try to add values to it, like

X(i;) = x

where i is vector of double of length 90, and i an integer, I get

conversion from cell to double is not possible

Is my understanding of the cell function correct?

Upvotes: 1

Views: 121

Answers (1)

Anonymous
Anonymous

Reputation: 18631

Cell contents are being addressed using curly braces, for example:

X{1,1}=1:8;

cell command creates an empty array:

C = cell(3,4,2);
% Or alternatively:
C{3,4,2} = [];

What you do with the cell array is up to you. But most likely it is not what you want - see Rasman's comment.

Have a look at some more examples either at MathWorks or other tutorials.

Upvotes: 1

Related Questions