필터 지우기
필터 지우기

Finding all pairs of non overlapping n/2*n/2 submatrices in an n*n matrix.

조회 수: 1 (최근 30일)
Daniel Wilson-NUnn
Daniel Wilson-NUnn 2015년 8월 17일
답변: Harsha Medikonda 2015년 8월 19일
Hi guys, I have seen this question here: http://uk.mathworks.com/matlabcentral/answers/169278-all-submatrices-of-given-order-of-a-given-matrix but I would like to be able to find all pairs of n/2*n/2 non overlapping submatrices in a given n*n matrix. Any ideas would be much appreciated.
EDIT: Note that here if one submatrix contains rows and columns 1 and 2, its pair must contain only rows and columns 3 and 4.
Many thanks,
Daniel

답변 (1개)

Harsha Medikonda
Harsha Medikonda 2015년 8월 19일
I understand that you wish to retrieve all pairs of non-overlapping sub-matrices from a matrix. Refer to the following example.
>>m = 4; n = 4;
>>mx = reshape(1:m*n, m, n);
>>rearranged=im2col(mx,[2 2],'sliding')
>>count_submatrices = size(rearranged,2)
>>s = reshape(rearranged, [2 2 count_submatrices])
In the above code we are creating a 4*4 matrix, and finding the non-overlapping 2*2 sub-matrices using "im2col" function.
Refer to the following documentation pages for more information

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by