Finding all pairs of non overlapping n/2*n/2 submatrices in an n*n matrix.
3 ビュー (過去 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!