How to get all combinations from this matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, everyone! Can someone help me with this? I want to use allcomb function for any matrix, any ideas how can I do this besides writing down every line of the vector?
ch=['MRWI'
'IDMZ'
'CGBI'
'JKNO']
v=[];
[x,y]=size(ch);
allcomb(ch(1,:),ch(2,:),ch(3,:),ch(4,:))
2 件のコメント
David Hill
2021 年 4 月 21 日
It is unclear what your expected output should be, show us your expected output.
採用された回答
Bruno Luong
2021 年 4 月 24 日
ch=['MRWI'
'IDMZ'
'CGBI'
'JKNO'];
c=num2cell(ch,2);
[c{:}]=ndgrid(c{:});
n=size(c,1);
c = reshape(cat(n+1,c{:}),[],n)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Quadratic Programming and Cone Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!