How to convert binary to floating points?

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

Respuestas (1)

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

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Preguntada:

el 9 de Mayo de 2019

Respondida:

el 9 de Mayo de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by