change data from cell array to a matrix

[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
[201×1300 double]
How do i take the value stored in the 1st row of 201 and form a matrix of 10x1300 and so on until 201 or to put it as 201cells of 10x1300 instead of 10cells of 201x1300.

 采纳的回答

To convert a cell array to a matrix, you can use cell2mat :
help cell2mat
cell2mat Convert the contents of a cell array into a single matrix.

6 个评论

thats not what im looking for, not a single giant matrix but 201 cells of matrix of 10x1300
Simply use cell2mat followed by mat2cell. What is the problem with that?
did any of you bother to count the rows and read what im asking? the cell array is 10x201x1300, why do you add them all up to form a 2010x1300 matrix?
Rudeness is not helping.
From that 2010x1300 matrix, you can make a 10x201x1300 matrix and then proceed to use num2cell or mat2cell to fit your needs.
"...the cell array is 10x201x1300"
Your original question shows what appears to be a 10x1 cell array, each cell of which contains a 201x1300 double array. If this is the case, then cell2mat optionally followed by reshape and finally mat2cell will work perfectly.
If the size of the cell array that you show in your original question does not reflect the true size of your actual cell array, then you will need to be a lot more precise in your explanation. You could help by showing us the output of this command:
size(yourCellArray)
"...why do you add them all up to form a 2010x1300 matrix?"
Because this is a simple way to achieve what you are asking for. Certainly simpler than trying to achieve this with loops.
Thank you for the full explanation, it is a 10x1 cell array, i will be trying it out.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by