How can I split a matrix of varying size (depending on data input) into new matrices of 3 columns each?
Show older comments
Basically I start off with a single matrix of arbitrary size (number of columns will be a multiple of 3 as data is XYZ coordinates of points) depending on the data input, and I want to split this matrix into new matrices of x rows by 3 columns each, in order to export the new matrices as single files. The issue is that the number of columns in the initial matrix will vary greatly, so I would prefer not to have to manually change the code to fit the number every data set.
Basically I want to be able to do this but without having to type out each "matrix1", etc:
matrix1 = coordinates(:,1:3);
matrix2 = coordinates(:,4:6);
matrix3 = coordinates(:,7:9);
Thanks in advance, Connor
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!