cell array in cell array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Takahiro
am 6 Apr. 2021
Kommentiert: Takahiro
am 6 Apr. 2021
a=cell(10,1);
for n=1:10
a{n}=cell(3,1);
a{n}{1}=datestr( now() );
a{n}{2}=now();
a{n}{3}=n;
end
% OK
a{1}
{'06-Apr-2021 19:02:25'}
{[ 7.3825e+05]}
{[ 1]}
% OK
a{1}{1}
'06-Apr-2021 19:02:25'
% I would like to obtain by
b = a{1:10}{3}
1,2,,,,,,10 % array
0 Kommentare
Akzeptierte Antwort
Stephen23
am 6 Apr. 2021
Bearbeitet: Stephen23
am 6 Apr. 2021
If you really want to use inconvenient nested cell arrays, this will work with your example data:
b = [a{:}];
b = [b{3,:}]
Note that using just one cell array (no nested cell arrays) makes this task simpler:
a = cell(10,3);
for n = 1:10
a{n,1} = datestr( now() );
a{n,2} = now();
a{n,3} = n;
end
a{1,1}
a{1,2}
b = [a{:,3}]
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!