www.gusucode.com > fixedpoint 案例源码程序 matlab代码 > fixedpoint/SettheBitataCertainPositionExample.m
%% Set the Bit at a Certain Position % Copyright 2015 The MathWorks, Inc. %% % Begin with an unsigned fixed-point |fi| number with a value of 5, word % length 4, and fraction length 0. a = fi(5,0,4,0); disp(bin(a)) %% % Set the bit at position 4 to |1| (on). c = bitset(a,4); disp(bin(c))