Generate matrices of the form [a b c d]
古いコメントを表示
If I have matrices of the form [a b c d]
where
2<=a<=4
1<=b<=2
3<=c<=4
2<=d<=4
Could someone help me with the code/pseudo code to generate all possible matrices?
3 件のコメント
per isakson
2015 年 3 月 11 日
編集済み: per isakson
2015 年 3 月 11 日
Are a,b,c,d whole numbers? If not, there will be very many possible vectors.
laurie
2015 年 3 月 11 日
Stephen23
2015 年 3 月 11 日
You can easily generate a cell array containing the requested permutations:
X = cell(1,4);
[~,X{:}] = ndgrid(1,2:4,1:2,3:4,2:4);
X = num2cell(cat(1,X{:}),1);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!