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

    %% Negative Numbers Using Two's Complement  
% Find the 8-bit representation of a negative number.   

%%  
A = -29;
b = bitget(A,8:-1:1,'int8')