All combinations not being generated
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone,
Running a code to get all combinations of vector. Each combination is unique on its own. Meaning, [.4, .1, .1] is different from [.1, .1, .4] and so on.
Ok, here is the code
A = [0.4, 0.25, 0.1] %vector
[A1,A2,A3] = ndgrid(A);
my_matrix= [A3(:),A2(:),A3(:)]
It does not give all combinations. In fact, the example stated above is missing.
If you run it and have a look at the last column, you'll see it is copy of the first column.
What am I doing wrong?
Thanks in advance!
0 件のコメント
採用された回答
その他の回答 (1 件)
David Hill
2020 年 11 月 29 日
perms(A);
3 件のコメント
Rik
2020 年 11 月 29 日
I would suggest reverting your edit, posting your edit as an answer and accept it.
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!