Split a specific matrix in 4 equal parts
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Daniele Cuomo
el 19 de Jun. de 2020
If I define the matrix as follows:
Given 4 matrix of equal dimensions, say A, B, C, D.
Let
E = [A B; C D];
May I do something like (totally pseudo-code):
B2 = E(B);
to retrieve the submatrix B without the use of cell arrays?
0 comentarios
Respuesta aceptada
KSSV
el 19 de Jun. de 2020
Editada: KSSV
el 19 de Jun. de 2020
M = rand(8) ;
[m,n] =size(M) ;
A = M(1:n/2,1:n/2) ;
B = M(1:n/2,n/2+1:end) ;
C = M(n/2+1:end,1:n/2) ;
D = M(n/2+1:end,n/2+1:end) ;
But the best would be:
m =size(M,1)/2 ;
A = mat2cell(M,[m m],[m m]) ;
A{1,1}
A{1,2}
A{2,1}
A{2,2}
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!