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?

 채택된 답변

KSSV
KSSV 2020년 6월 19일
편집: KSSV 2020년 6월 19일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2020년 6월 19일

편집:

2020년 6월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by