Find size of array
21 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
the cyclist
2015 年 12 月 5 日
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 件のコメント
Image Analyst
2015 年 12 月 5 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で GPU Computing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!