How to extract matrix from cell?

2 Ansichten (letzte 30 Tage)
Lilya
Lilya am 20 Aug. 2021
Kommentiert: Lilya am 21 Aug. 2021
Hi all,
I have a bunch of matrices in the cell array (1*365). Each of these matrices has a dimension of (21*41*24). I have to extract the matrices from 32 to 59 and store them in one double array.
by using the following code, I got the last matrix
for i = 32:59;
iwant = myCell{i} ;
end
Any help is appreciated.

Akzeptierte Antwort

Simon Chan
Simon Chan am 20 Aug. 2021
Try this:
iwant=cat(4,myCell{32:59});

Weitere Antworten (1)

Chunru
Chunru am 20 Aug. 2021
iwant = zeros(21, 41, 24, 28); % 32->59: 28
for i = 32:59;
iwant(:, :, :, i) = myCell{i} ;
end
  3 Kommentare
Chunru
Chunru am 21 Aug. 2021
Are you sure?
Lilya
Lilya am 21 Aug. 2021
Yes

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrices and Arrays 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!

Translated by