How can I generate a set containing all possible combinations?
5 views (last 30 days)
Show older comments
Let say I want to have a 2x2 matrix and the entries are chosen from numbers 1-8 (without repetition).
How can I generate a set that contains all the possible matrices? Thanks a lot!
0 Comments
Answers (2)
Bruno Luong
on 28 Mar 2019
Edited: Bruno Luong
on 28 Mar 2019
A = nchoosek(1:8,4);
A = num2cell(reshape(A',2,2,[]),[1 2]);
A = A(:);
% display
A{:}
Produces 70 2x2 matrices
0 Comments
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!