www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SetBitstoOnExample.m

    %% Set Bits to On  
% Add powers of 2 onto a number.   

%%  
A = 4;
intout = bitset(A,4:6)  

%% 
% You can see that |bitset| sequentially turns on bits 4 through 6. 
c = dec2bin(intout)