MATLAB: Error using bitset fuction

bitset

i have value A=46;
i used bitset function to change the second bit ,i get abswer ,but how to change the last 2 bits ,i tried using
X=bitset(A,1:2,1); setting last two bits to one
please help

Best Answer

bitset() is not defined to be able to change two bits at a time.
bitset(bitset(A, 1, 1), 2, 1)