필터 지우기
필터 지우기

List all possible outcomes of 16 matches

조회 수: 2 (최근 30일)
Daniel Ring
Daniel Ring 2018년 9월 19일
답변: Bruno Luong 2018년 9월 19일
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!

채택된 답변

Bruno Luong
Bruno Luong 2018년 9월 19일
dec2bin(0:2^16-1)-'0'

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by