How to convert binary to floating points?

15 visualizzazioni (ultimi 30 giorni)
N M Channabasavayya
N M Channabasavayya il 9 Mag 2019
Risposto: Guillaume il 9 Mag 2019
I have the following code,which converts the wavdata into binary sequence.
wavbinary = dec2bin( typecast(single(wavdata(:)),'uint8'),8)-'0';
Now I want to convert the binary bits into floating poins such that the new floating points should match to the wavdata contents.
help me out!
Thank you

Risposte (1)

Guillaume
Guillaume il 9 Mag 2019
wavsingle = typecast(uint8(sum(wavbinary .* 2.^(7:-1:0), 2)), 'single')

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by