Finding all pairs of non overlapping n/2*n/2 submatrices in an n*n matrix.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!