Info

此问题已关闭。 请重新打开它进行编辑或回答。

three sequences with bits,Can you show me possibility?

2 次查看(过去 30 天)
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

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by