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

    %% Get a Slice of Consecutive Bits with Fixed-Point Indexes  

% Copyright 2015 The MathWorks, Inc.


%% 
% Begin with the following fixed-point number. 
a = fi(85,0,8,0);
disp(bin(a))  

%% 
% Get the binary representation of the consecutive bits from |fi(6)| to
% |fi(2)|. 
c = bitsliceget(a,fi(6),fi(2));
disp(bin(c))