MATLAB: How to permute all combinations of this vector?

vectors

hello i'm struggling to write code for this problem; I want to display all possible combinations of the vectors of the form (1,b1,b2,b3,…..bN),where bi∈{0,1}
so the first entry of the vector is always 1 and the rest take the value 0 or 1. I then want to print every combination of this. How would you go about coding this ?? thanks for your help in advance

Best Answer

This is one approach:
N = 4 ;
[b{1:N}] = ndgrid([0 1])
c = reshape(cat(N+1, ones(size(b{1})), b{:}), [], N+1)