How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
조회 수: 5 (최근 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!