Dividing matrix in four parts
1 view (last 30 days)
Show older comments
I have a matrix with three columns and n rows.
I would like to produce four matrices with three columns and different rows. it is not important that matrices do not have the same rows.
For instance:
A has 210 rows.
I want to have B with 40 rows, C with 60 rows, D with 30 rows, and E with 80 rows.
Thanks a lot for help.
0 Comments
Answers (2)
Azzi Abdelmalek
on 27 Jun 2016
A=rand(210,3);
out=mat2cell(A,[40 60 30 80]',3)
You have your 4 matrices
out{1}
out{2}
out{3}
out{4}
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!