フィルターのクリア

How do I convert binary strings from a text file to fixpoint numbers?

4 ビュー (過去 30 日間)
Dominik Hiltbrunner
Dominik Hiltbrunner 2020 年 7 月 20 日
回答済み: Anmol Dhiman 2020 年 7 月 27 日
I have a text file in which each row contains one 60-bit number representing a signed fixed point number with 44-bit fraction, i.e. a sfi(x,60,44) object.
I cannot find a method to convert this binary string back to a signed floating point object in Matlab.
Example:
x = '000000000000000100000000000000000000000000000000000000000000' corresponds to the decimal number '1' in my format.
Using
sfi(bin2dec(x), 60, 40)
yields the wrong result.
How to do this correctly?
I found this solution but I cannot use the reinterpretcast function since the wordlength does not match with a int32 or int64 datatype.

回答 (1 件)

Anmol Dhiman
Anmol Dhiman 2020 年 7 月 27 日
Hi Dominik,
Refer to link for solution to a similar question.
Regards,
Anmol Dhiman

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by