How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
lil brain
el 11 de Dic. de 2022
Comentada: Arif Hoq
el 12 de Dic. de 2022
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 comentarios
Respuesta aceptada
Arif Hoq
el 12 de Dic. de 2022
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 comentarios
Arif Hoq
el 12 de Dic. de 2022
If the dimension of cell arrays are equal it's quite easy to simulate.
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!