# Finding size of a cell

119 views (last 30 days)
Volkan Kandemir on 10 Jun 2012
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?

the cyclist on 10 Jun 2012
Could you nest your cell array, using the line
>> A{k}{i,j}=num2str(100*k+10*i+j);
Then use
>> size(A{2})
Volkan Kandemir on 10 Jun 2012
excellent