Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

three sequences with bits,Can you show me possibility?

조회 수: 1 (최근 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