# 1X1500 cell array to matrix

3 views (last 30 days)

Show older comments

##### 0 Comments

### Answers (2)

Adam Danz
on 24 Jan 2019

Since each matrix is the same size, here's an easy solution: If your cell array is named 'ca', 'm' will be your 3D array.

m = reshape(cell2mat(ca), 71022, 5, 1500);

How this works:

cell2mat() converts your 1x1500 cell into a 71022x(1500*5) matrix.

reshape() converts that matrix into a 3D array with 71022 rows, 5 columns, and 1500 pages.

##### 12 Comments

Adam Danz
on 25 Jan 2019

Bob Thompson
on 24 Jan 2019

You can try using cell2mat(), but I'm not intimately familiar with it enough to know if it will work with arrays inside each cell, or if you need to just have doubles.

Alternatively, you can always just use a loop:

for i = 1:size(cellarray,2)

3dmatrix(:,:,i) = cellarray{i};

end

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!