change the quantization level of data

Hi,
I want to change the quantization level of a data. The original data is acquired in 16 bit format. I want to encode it in 2 bit. How can I do this?
-saima

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 29 Aug. 2013

0 Stimmen

Divide the data by 2^14

3 Kommentare

saima
saima am 29 Aug. 2013
Thanks :)
After that you have only 4 values, so might as well cast your data to uint8 and save a byte of space per element.
data2bits = uint8(data16bits / 2^14);
and you do realize that it's still an 8 bit variable even though it has only 2 bits of information in it, don't you?
Walter Roberson
Walter Roberson am 30 Aug. 2013
Watch out for rounding -- you need to decide whether you want it or do not want it. uint8() rounds as it converts.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu External Language Interfaces finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by