Finding size of a cell
33 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
the cyclist
el 10 de Jun. de 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})
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Types en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!