conversion of cell 30X1 in 30X24

4 views (last 30 days)
PETROS MOSCHOPOULOS
PETROS MOSCHOPOULOS on 28 Sep 2015
Answered: Guillaume on 28 Sep 2015
Hi,everyone. I have a cell 30X1 and i want to convert it in a cell 30X24 to do mathematical operation line by line.I attached an image to help you undarstand what i want to do.

Answers (1)

Guillaume
Guillaume on 28 Sep 2015
Assuming your cell array consists of 30 1x24 matrices, you could just concatenate them all vertically:
c = num2cell(repmat(1:24, 30, 1), 2); %demo cell array
m = vertcat(c{:})
I would leave it at that and work with a matrix from then one. Matrices are much easier to deal with than cell arrays.
If you do really want to have a 30x24 cell array, use num2cell to convert the matrix into a cell array:
newc = num2cell(vertcat(c{:}))
As said, there is little point in the final cell array

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!