How to create all possible outcome of a set amount of variables?

4 ビュー (過去 30 日間)
Kalpha.mc
Kalpha.mc 2020 年 9 月 12 日
コメント済み: Kalpha.mc 2020 年 9 月 12 日
So i have 3 numbers from 1-3. How would i create a matrix of all the possible outcome without repeating the number in each matrix.
such as
[1,2,3]
[3,2,1]
[2,1,3,]
[3,1,2]
......etc
Then display how many different combination there was.
The example i provided there are 4 rows total.

採用された回答

madhan ravi
madhan ravi 2020 年 9 月 12 日
CombS = perms(1 : 3)
How_many = size(CombS, 1)
  1 件のコメント
Kalpha.mc
Kalpha.mc 2020 年 9 月 12 日
How would i do it if it was 1-120 by 3 columns?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by