Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

three sequences with bits,Can you show me possibility?

1 visualización (últimos 30 días)
Milos Kopec
Milos Kopec el 5 de Dic. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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...

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Dic. de 2018
Use bitget() and bitset()
  5 comentarios
Milos Kopec
Milos Kopec el 6 de Dic. de 2018
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 el 6 de Dic. de 2018
newA = [A(1) B(2) C(2) A(4) etc]

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by