How to remove MSB bit from a binary number?
Ältere Kommentare anzeigen
suppose i have an cell array 'c' of 1*256 size.
let c(1)=10010000
i want
p1= 10010000;
p2=0010000;
p3=010000;
p4=10000;
p5=0000;
p6=000;
p7=00;
p8=0;
it means in each step the MSB should be removed.. Thank you..plz any body suggest...
2 Kommentare
Walter Roberson
am 8 Nov. 2016
What is the the data type?
aditya kumar sahu
am 8 Nov. 2016
Akzeptierte Antwort
Weitere Antworten (1)
Guillaume
am 9 Nov. 2016
b = imresize(imread('f.jpg'), [16 1]);
d = arrayun(@(s) bitshift(b, -s), 1:8, 'UniformOutput', false);
d{1} is all the values of b shifted by 1 bit, d{2} is all the values of b shifted by 2 bits, ... d{8} is all the values of b shifted by 8 bits.
There is absolutely no point in converting numbers in strings of 0 and 1 to manipulate bits Computers are much better at manipulating bits of numbers than they are at manipulating characters of strings.
You can always convert the d{i} to strings if you really wish to.
1 Kommentar
aditya kumar sahu
am 10 Nov. 2016
Kategorien
Mehr zu Image Preview and Device Configuration 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!