How to find all possible 8x8 submatrices of a 13x8 matrix?

조회 수: 3 (최근 30일)
HN
HN 2022년 8월 4일
편집: Matt J 2022년 8월 4일
I have martrix A with size 13x8, and I want to find a list of all the possible 8x8 submatrices combinations of matrix A.
The number of submatrices possible is 13C8 = 1287
Any help is appreciated!

채택된 답변

Torsten
Torsten 2022년 8월 4일
r = nchoosek(1:13,8);
A = rand(13,8);
for i = 1:size(r,1)
B(:,:,i) = A(r(i,:),:);
end
size(B)
ans = 1×3
8 8 1287

추가 답변 (1개)

Matt J
Matt J 2022년 8월 4일
편집: Matt J 2022년 8월 4일
Using this File Exchange tool set,
A=rand(13,8);
submatrices = blkReshape( A(nchoosek(1:13,8)', : ) ,[8,8],1,1,[]);
whos submatrices
Name Size Bytes Class Attributes
submatrices 8x8x1287 658944 double
  댓글 수: 3
Matt J
Matt J 2022년 8월 4일
Make sure you have my latest version.
HN
HN 2022년 8월 4일
Sure, will check. Thank you!

댓글을 달려면 로그인하십시오.

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by