www.gusucode.com > fixedpoint 案例源码程序 matlab代码 > fixedpoint/PerformBitwiseANDOperationOnARangeOfBitsInAVectorExample.m
%% Perform Bitwise AND Operation on a Range of Bits in a Vector % %% % Create a fixed-point vector. % Copyright 2015 The MathWorks, Inc. a = fi([12, 4, 8, 15],0,8,0); disp(bin(a)) %% % Perform a bitwise AND operation on the bits of each element of |a|, % starting at position |fi(4)|. c = bitandreduce(a, fi(4)) %% % The only element in output |c| with a value of 1 is the 4th element. This is % because it is the only element of |a| that had only 1's between positions |fi(4)| and 1.