Need to split matrix(m x n) where n varies
Show older comments
Hello everyone,
I have read a lot about splitting matrices and have come close to my intended output but I'm still not there. My matrix is size (7745 x 13 double) and I would like to create 2 new datasets. The number of datasets produced will vary depending on the number of columns in the matrix(which will depend on the number of objects imported):
7 cols = 1 dataset
13 cols = 2 datasets
19 cols = 3 datasets
etc...
Each dataset needs to have 7 cols of data(the 1st col will be reproduced in each dataset followed by the next 6 cols):
Dataset 1 = matrix(cols_1-7
Dataset 2 = matrix(col_1, cols_8-13)
Dataset 3 = matrix(col_1, cols_14-19)
etc...
Given that the matrix dimension 'n' will vary by a value of 6 depending on the number of objects imported I would like the code to be dynamic. I know I can do this interactively but I will also be working with big data and would like a programatic solution.I am not sure if this is possible, efficient or otherwise. I will need to access each column individually and know what "group" of 7 vectors it belongs to, thats why I am thinking datasets, maybe struct would be better.
Thanks for you help,
Please let me know if I can provide any other info to help with the solution.
Accepted Answer
More Answers (1)
Categories
Find more on Data Type Identification 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!