% MS-A050x L1B example 1 fprintf('number of choices of 2 positions out of 4\n') nchoosek(4, 2) fprintf('\n') fprintf('choices of 2 positions out of 4\n') C=nchoosek([1 2 3 4], 2) fprintf('\n') fprintf('sequences that have 2 ones\n') for c=C' seq = zeros(1,4); seq(c) = 1; disp(seq) end