Binary-Float convertor

There are two functions to convert floats and binary streams to each other
683 Downloads
Updated 3 May 2016

View License

Matlab builtin functions bin2dec and dec2bin are not sufficient for float to binary and binary to float conversions. float2bin(in) function takes a floating point number as an input and returns a binary representation. bin2float(bin) function takes a binary representation as an input and returns a floating point number.
Example usage:
>> out = float2bin(6.875)

out =

110.111

>> out = bin2float('110.111')

out =

6.8750

Cite As

Dogac Basaran (2024). Binary-Float convertor (https://www.mathworks.com/matlabcentral/fileexchange/56893-binary-float-convertor), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Type Conversion in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0