Clear Filters
Clear Filters

How can I convert matrix to cell?

18 views (last 30 days)
majid
majid on 15 Apr 2024 at 10:03
Commented: majid on 15 Apr 2024 at 11:13
Hello.
I have 400*100 matrix. I want to divide this matrix to every 4*100 matrix and then put it in the cell.
How can I do this?
A = reshape(1:40000,100,400)';

Accepted Answer

Stephen23
Stephen23 on 15 Apr 2024 at 10:41
A = reshape(1:40000,100,400)';
C = mat2cell(A,4*ones(1,100),100)
C = 100x1 cell array
{4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double} {4x100 double}

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!