How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
Ältere Kommentare anzeigen
Hi,
I have a cell array called split_newdata_mean which contains multiple cells. Each of these cells contains five values in five rows.
I am looking to create a new numerical array in which the first column contains all the values from the first row of each cell in split_newdata_mean, the second column contains all the values from the second row of the of each cell and so on.
In the end I would have a array with five columns and as many rows as there are cells in split_newdata_mean.
How would that look?
Thank you!
Akzeptierte Antwort
Weitere Antworten (1)
n = 13;
C = cell(1,n);
for i=1:n
C{i} = rand(5,1);
end
A = cell2mat(C)
class(A)
4 Kommentare
lil brain
am 11 Dez. 2022
C is split_newdata_mean.
So you should only need the command
A = cell2mat(split_newdata_mean)
if your explanation about split_newdata_mean is correct (cell array of size (1,n) with each element containing a column vector with 5 elements).
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!