Info

この質問は閉じられています。 編集または回答するには再度開いてください。

three sequences with bits,Can you show me possibility?

2 ビュー (過去 30 日間)
Milos Kopec
Milos Kopec 2018 年 12 月 5 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
random generated 0 and 1 in 3 sequences
I have 3 sequnces for 8 bits
My desired result :
black dots - bits stay on position
B2,C2 ,A2 A5 etc ,bits are replaced among sequences...
Does exist command/tutorial/video etc how to make it? I really dont know how to find the answer...

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 12 月 5 日
Use bitget() and bitset()
  5 件のコメント
Milos Kopec
Milos Kopec 2018 年 12 月 6 日
yes, but I didnt know how to use them, probably I wrote it bad, I using this code :
clear all
clc
x = randi([0 1],24,1) ;
iwant = reshape(x,[8,3]) ;
A = iwant(:,1)
B = iwant(:,2)
C = iwant(:,3) ;
newA = bitset(A, 5, bitget(B, 3)) %set bit 5 of A to bit 3 of B
For me it looks that it is not working well,but I'm probably wrong, Can u check it please
command window :
A =
1
0
0
0
1
0
0
0
B =
1
1
1
0
1
0
1
0
newA =
1
0
0
0
1
0
0
0
Walter Roberson
Walter Roberson 2018 年 12 月 6 日
newA = [A(1) B(2) C(2) A(4) etc]

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by