Borrar filtros
Borrar filtros

List all possible outcomes of 16 matches

2 visualizaciones (últimos 30 días)
Daniel Ring
Daniel Ring el 19 de Sept. de 2018
Respondida: Bruno Luong el 19 de Sept. de 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!

Respuesta aceptada

Bruno Luong
Bruno Luong el 19 de Sept. de 2018
dec2bin(0:2^16-1)-'0'

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by