how to divide matrix into sub matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sina arfaee
le 23 Fév 2019
Réponse apportée : madhan ravi
le 23 Fév 2019
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 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!