MATLAB: Invert bit vector

MATLABsimulink

Hi,
I wonder how to make invert bit vector ?
*For example:*
I have A vector: A=[0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0] that mean 2 couples LSB are 1 0 1 0 and the rest are 01 0 1 0 1 0 1 0 1 0 1
And I want to invert it to B=[1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1] the result of the inverted vector should be MSB 1 0 1 0 and the rest couple bits 0 1 0 1 0 1 0 1 0 1 0 1.
Anyone knows how to do it ?
Thanks,
Henry

Best Answer

>> A=[0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0];
>> B=[1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1];
>> C = [A(end-3:end),A(1:end-4)];
>> isequal(B,C)
ans =
1