%% Set Bits to Off
% Repeatedly subtract powers of 2 from a number.

a = intmax('uint8')

%

for k = 0:7
   a = bitset(a, 8-k, 0);
   b(1,k+1) = a;
end
b

% Copyright 2012 The MathWorks, Inc.