Finding size of a cell
33 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
Let create a cell multi dimensinal cell A with the following code.
for k=1:4
for i=1:k
for j=1:2*k
A{i,j,k}=num2str(100*k+10*i+j);
end
end
end
%------------------------------------------------------------------
%resault will be
A(:,:,1) =
'111' '112' [] [] [] [] [] []
[] [] [] [] [] [] [] []
[] [] [] [] [] [] [] []
[] [] [] [] [] [] [] []
A(:,:,2) =
'211' '212' '213' '214' [] [] [] []
'221' '222' '223' '224' [] [] [] []
[] [] [] [] [] [] [] []
[] [] [] [] [] [] [] []
A(:,:,3) =
'311' '312' '313' '314' '315' '316' [] []
'321' '322' '323' '324' '325' '326' [] []
'331' '332' '333' '334' '335' '336' [] []
[] [] [] [] [] [] [] []
A(:,:,4) =
'411' '412' '413' '414' '415' '416' '417' '418'
'421' '422' '423' '424' '425' '426' '427' '428'
'431' '432' '433' '434' '435' '436' '437' '438'
'441' '442' '443' '444' '445' '446' '447' '448'
----------------------------------------------
% Now I want to find the size of A(:,:,2) as 4 and 2.
[r,c]=size(A(:,:,2)) will give a resault of
[r,c]=size(A(:,:,2))
r =
4
c =
8
Do you know any function which gives the resault as 4 and 2?
0 件のコメント
採用された回答
the cyclist
2012 年 6 月 10 日
Could you nest your cell array, using the line
>> A{k}{i,j}=num2str(100*k+10*i+j);
Then use
>> size(A{2})
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!