フィルターのクリア

How to split vector to seqences

1 回表示 (過去 30 日間)
Milos Kopec
Milos Kopec 2018 年 12 月 3 日
回答済み: Milos Kopec 2018 年 12 月 3 日
Hello, can u help me please? I want to split generated numbers to 3 sequences for 8 bits ,for example i used :
x = randi([0 1],24,1)
and now i want to split these 24 numbers to 3 sequences for 8 bits, I could not find the answer.

回答 (3 件)

ahmed nebli
ahmed nebli 2018 年 12 月 3 日
編集済み: ahmed nebli 2018 年 12 月 3 日
u can use something like that:
for i=1:8:24
var = x[i,1]; % here you need to do what store var in someplace else in order not to loose it
end
  1 件のコメント
Milos Kopec
Milos Kopec 2018 年 12 月 3 日
thank you

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


Fangjun Jiang
Fangjun Jiang 2018 年 12 月 3 日
reshape(x,3,[])
reshape(x,[],3)
  1 件のコメント
Milos Kopec
Milos Kopec 2018 年 12 月 3 日
thank you,I try use this

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


Milos Kopec
Milos Kopec 2018 年 12 月 3 日
Guys I thinking about it, can you help me yet ? Idk if I do it right. so I have to task , witch consits of 3 parts:
  1. generate random bit sequence 0,1 .... I did this
  2. split generated numbers to 3 sequences for 8 bits ... you helped me with this
  3. replace bit positions within the sequence I create myself ... I have no idea how to do it , I used mathworks,google, but I still could not find the answer. I do not understand that.
Can you help me please ?
my code looks like this :
clear all;
x = randi([0 1],24,1) %generate 0,1
reshape(x,[8,3]) % splited 3,8
In command window it looks like this :
x =
1
1
0
1
0
0
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
0
ans =
1 1 0
1 0 0
0 1 1
1 0 1
0 1 1
0 1 1
1 1 1
1 0 0 20181203_224007.jpg

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by