How to shift elements in a row matrix?

1 回表示 (過去 30 日間)
Darsana P M
Darsana P M 2017 年 10 月 20 日
コメント済み: Anu 2018 年 8 月 25 日
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??

採用された回答

KL
KL 2017 年 10 月 20 日
If you have access to Fixed-Point Designer toolbox, you could use bitsll
  9 件のコメント
KL
KL 2017 年 10 月 22 日
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 2017 年 10 月 22 日
Yes. thank you sir

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2017 年 10 月 20 日
x1=zeros(size(x));
x1(2:end)=x(1:end-1)
  4 件のコメント
Darsana P M
Darsana P M 2017 年 10 月 21 日
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 2018 年 8 月 25 日
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?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeArray and Matrix Mathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by