How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
显示 更早的评论
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!
采纳的回答
更多回答(1 个)
n = 13;
C = cell(1,n);
for i=1:n
C{i} = rand(5,1);
end
A = cell2mat(C)
class(A)
4 个评论
lil brain
2022-12-11
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).
类别
在 帮助中心 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!