is there a simple command to do this:
M = 0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
i found this http://www.mathworks.co.kr/matlabcentral/fileexchange/7147-combn--4-3- but this isn't yet a thing in matlab
tried M = combn([0 1],3)
bo i got Undefined function 'combn' for input arguments of type 'double'. in return
An easy approach is to generate all numbers from 0
to 2^n-1
, where n
is the number of rows, and convert them into binary:
n = 3;
result = dec2bin(0:2^n-1)-'0';
Or particularize this Q&A to your case.