Replacing 5 bits in a binary value
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
kash
am 22 Nov. 2012
Bearbeitet: Abdul Gaffar
am 5 Dez. 2019
i have two vales such as
A=1078;
B=25;
now i want to embed this B value in A ,embedding layer is 8,
Binary value of A is 10000110110
Binary value of B is 11001
after embedding in 8th position fron LSB I WILL GET 10011001110
please help
0 Kommentare
Akzeptierte Antwort
Pedro Villena
am 22 Nov. 2012
Bearbeitet: Pedro Villena
am 22 Nov. 2012
C = dec2bin(A);
D = dec2bin(B);
n = 4; %%start bit position from MSB (1st bit position is 1)
C(:,n:n+size(D,2)-1)=D %%replace of some bits of C from D
2 Kommentare
Abdul Gaffar
am 5 Dez. 2019
Bearbeitet: Abdul Gaffar
am 5 Dez. 2019
Though its been very long time, I have seen today:
A = [1056;1078];
B = [31;25];
C = dec2bin(A)
D = dec2bin(B)
n = 7; %%start bit position from MSB (1st bit position is 1)
C(:,n:n+size(D,2)-1) = D
Output: C
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!