Invert bit vector ?

10 visualizaciones (últimos 30 días)
Henry Buck
Henry Buck el 5 de Mzo. de 2016
Editada: Henry Buck el 18 de Mzo. de 2016
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

Respuesta aceptada

Stephen23
Stephen23 el 5 de Mzo. de 2016
>> 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
  6 comentarios
Walter Roberson
Walter Roberson el 6 de Mzo. de 2016
Please format your entries.
Henry Buck
Henry Buck el 12 de Mzo. de 2016
Hi, Thank you for Your answer.
I think I did not understand your last comment.
Henry

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Naming Conventions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by