Find size of array
6 views (last 30 days)
Show older comments
For A_Set1{2}
ans =
{1x3 cell} {1x3 cell}
{1x3 cell} {1x3 cell}
{1x3 cell} {1x3 cell}
{1x4 cell} {1x3 cell}
{1x4 cell} {1x3 cell}
{1x4 cell} {1x3 cell}
When I tried to find the size, I get the error function:
>> size(A_Set1{2})
>> Function 'subsindex' is not defined for values of class 'cell'
Yet when the length is used,
>> length(A_Set1{2}) = 6
How do you find the size of the array then i.e. [6 2]?
EDIT: should have written "size" instead of "Size"
0 Comments
Answers (2)
the cyclist
on 5 Dec 2015
Not sure, but I have a couple guesses. You are showing that you used Size rather than size. MATLAB is case-sensitive.
You may have accidentally defined size to be some other command or function. What do you get if you type
which size
You would get something like
built-in (/Applications/MATLAB_R2015b.app/toolbox/matlab/elmat/size)
0 Comments
Image Analyst
on 5 Dec 2015
length() gives the longest dimension (regardless of which direction it's going in), whereas size() gives all the dimensions - that's why length() gives 6. A_Set1 is a cell array with at least 2 cells. The second cell of A_Set1 contains another cell array, and that cell array is 6 rows by 2 columns. I would think it should work so all I can suggest is that you try what cyclist suggested, and attach a .mat file with your variable if that still does not work. Also, what does this produce:
>> cell2 = A_Set1{2}
>> numel(cell2)
>> whos cell2
0 Comments
See Also
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!