www.gusucode.com > fixedpoint 案例源码程序 matlab代码 > fixedpoint/PerformBitwiseOROperationonaRangeofBitsinaVectorExample.m
%% Perform Bitwise OR Operation on a Range of Bits in a Vector % Copyright 2015 The MathWorks, Inc. %% % Create a fixed-point vector. a=fi([12,4,8,15],0,8,0); disp(bin(a)) %% % Perform a bitwise |OR| operation on the bits of each element of |a|, starting % at position |fi(4)|. c=bitorreduce(a,fi(4)) %% % All of the entries of output |c| have a value of |1| because all of the % entries of |a| have at least one bit with a value of |1| between the positions % |fi(4)| and 1.