Bit missing after circular shift
Ältere Kommentare anzeigen
I have noticed that after performing circular shift, the bit after the shift value is missing.
Shiftvalue = randi(2, n)
n is the max length of array
X = circshift(A, [1, Shiftvalue])
Problem : if Shiftvalue is 25, then the 26th bit is missing. Please help.
2 Kommentare
Azzi Abdelmalek
am 11 Apr. 2016
Can you post an example?
Amrita K
am 11 Apr. 2016
Bearbeitet: Image Analyst
am 11 Apr. 2016
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 11 Apr. 2016
This works just as expected for me:
ShiftValue = 27
A=[9 0 1 1 0 1 1 0 0 1 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0]
X = circshift(A, [0, ShiftValue])
% Element 1 (which is 9) should now be at element 28.
X(28) % It is 9, just as expected!
Kategorien
Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!