how to divide matrix into sub matrix
1 view (last 30 days)
Show older comments
Hi
Come to assume that we have a matrix (6*8) and we want to divide it to 12 (1*4) matrix.
How can we do that?
p.s. mat2cell is not useful for our situation!!!
I write below script but the problem is that the output B only show the last 1*4 matrix, I want to show all 12 matrix in output
clear all;
clc;
A=[1 2 3 4 5 6 7 8;
9 10 11 12 13 14 15 16;
17 18 19 20 21 22 23 24;
25 26 27 28 29 30 31 32;
33 34 35 36 37 38 38 40;
41 42 43 44 45 46 47 48];
row=6;
column=8;
for i=1:row
for j=1:4:column
B=A(i,j:j+3)
end
end
Thanks a lot

0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Operators and Elementary Operations 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!