How to get all combinations from this matrix?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Robu Robert
am 21 Apr. 2021
Beantwortet: Bruno Luong
am 24 Apr. 2021
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 Kommentare
David Hill
am 21 Apr. 2021
It is unclear what your expected output should be, show us your expected output.
Akzeptierte Antwort
Bruno Luong
am 24 Apr. 2021
ch=['MRWI'
'IDMZ'
'CGBI'
'JKNO'];
c=num2cell(ch,2);
[c{:}]=ndgrid(c{:});
n=size(c,1);
c = reshape(cat(n+1,c{:}),[],n)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Quadratic Programming and Cone Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!