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

3 views (last 30 days)
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!

Accepted Answer

Torsten
Torsten on 4 Aug 2022
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

More Answers (1)

Matt J
Matt J on 4 Aug 2022
Edited: Matt J on 4 Aug 2022
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 Comments

Sign in to comment.

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!