How to shift elements in a row matrix?

8 visualizaciones (últimos 30 días)
Darsana P M
Darsana P M el 20 de Oct. de 2017
Comentada: Anu el 25 de Ag. de 2018
Suppose i have a vector x=[1 1 1 1 0 0 1 1] i want 1 bit shifting such that the output is x1=[0 1 1 1 1 0 0 1] x2=[0 0 1 1 1 1 0 0]
How to do this??

Respuesta aceptada

KL
KL el 20 de Oct. de 2017
If you have access to Fixed-Point Designer toolbox, you could use bitsll
  9 comentarios
KL
KL el 22 de Oct. de 2017
All of it should be of the same size, yes! If you used the code I showed you above, you'd get the result of exactly the same size.
Darsana P M
Darsana P M el 22 de Oct. de 2017
Yes. thank you sir

Iniciar sesión para comentar.

Más respuestas (1)

Matt J
Matt J el 20 de Oct. de 2017
x1=zeros(size(x));
x1(2:end)=x(1:end-1)
  4 comentarios
Darsana P M
Darsana P M el 21 de Oct. de 2017
Then could you please exlain these steps: x1=zeros(size(x)); x1(2:end)=x(1:end-1); By the first step it means adding zeros according to the size of x. But i didnot understand the second step.
Anu
Anu el 25 de Ag. de 2018
i want this code to execute for every iterations.I need to run it for 64 times and i need to display from 1to 64.how could i do this?

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by