How to remove the least significant bit of a signed int16

조회 수: 14 (최근 30일)
Hasan Ghorbani
Hasan Ghorbani 2015년 8월 18일
답변: blaat 2015년 8월 18일
I have a series of int16 values and I need to remove LSB out of them and make them 15 bits. How can I do that?
Note: I don't want to use any toolbox other than MATLAB's built-in ones.

채택된 답변

blaat
blaat 2015년 8월 18일
You could use bitset() to set the LSB to 0, but they will still be 16-bits in memory. For example:
a = [56, 21, 33];
b = bitset(a, 1, 0);
then b will be
[56, 20, 32]
but still of type int16.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by