Divide a Large Matrix into Smaller Matrices in a Loop
Show older comments
Hi all,
I have a Matrix of dimensions 20x5.
I need to run calculations, using For loops, on a program that first needs the first 4 lines of the large matrix, then the next 4 lines etc...
In other terms: 1 iteration ---> Large matrix lines [1 to 4 x 5] .... used for the calculations. Then 2 iteration ---> Large matrix lines [5 to 8 x 5] .... used for 2nd iteration calculations. Then 3 iteration ---> Large matrix lines [9 to 12 x 5].... used for 3rd iteration calculations etc...
Does anyone has an idea on how to make it happen?
Accepted Answer
More Answers (1)
Andrei Bobrov
on 21 Nov 2017
Edited: Andrei Bobrov
on 21 Nov 2017
mat1 - matrix with size (20,5)
row1 = 4;
Matrix1 = permute(reshape(mat1.',size(mat1,2),row1,[]),[2,1,3]);
Categories
Find more on Matrices and 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!