% allbinary.m % generates an n x 2^n matrix with all possible binary strings of length n % in it % % n = size of binary matrix function B = allbinary(n) B=zeros(2^n,n); count = 2; while count <= 2^n count2 = count; while count2 <= 2^n temp = B(count2, 1:n); temp = addone(temp); B(count2, 1:n) = temp;; count2 = count2+1; end count=count+1; end