How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
20 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
Arif Hoq
2022-12-12
The dimension of the 4th Column of your cell array is 4x1, but the rest of your cell array is 5x1.
a=load("split_newdata_mean.mat");
b=a.split_newdata_mean;
b{1,4}=[b{1,4};NaN]; % making equal dimension in the 4th column
c=[b{:}];
new_mat=c'
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!