List all possible outcomes of 16 matches

2 Ansichten (letzte 30 Tage)
Daniel Ring
Daniel Ring am 19 Sep. 2018
Beantwortet: Bruno Luong am 19 Sep. 2018
I am trying to make a code that will list all of the possible outcomes of 16 matches (only wins or losses, no draws), essentially the same as flipping a coin 16 times. I've tried using functions like combnk and nchoosek, but they cannot build a 16 column matrix with only two outcomes.
Ideally, the outcome would be a 16 X 4096 matrix (65,536 combinations) which would look like this
H H H H H H H H H H H H H H H H
H H H H H H H H H H H H H H H A
H H H H H H H H H H H H H H A H
And so on. Or, if the argument needed numbers, like this
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
...
Thank you for your help!

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 19 Sep. 2018
dec2bin(0:2^16-1)-'0'

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays 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!

Translated by