convert fixed point to real data
113 ビュー (過去 30 日間)
Hi, I use the command sfi to convert real values into fixed point representation. Specifically, I use this:
F=sfi(my_value, 32, 16);
Now, I need to do the opposite. Convert the fixed point to real value. Any ideas? Is there a command for that?
回答 (4 件)
Massimo Zanetti 2017 年 3 月 15 日
Does this help you?
a = sfi(pi);
%convert to double
d = double(a)
John D'Errico 2017 年 3 月 15 日
編集済み: John D'Errico 2017 年 3 月 15 日
In general, whenever you want to convert a numeric value in some other class into a double precision number, you use the function double. This is said without even looking to see if double is defined for that toolbox (I don't have that TB.) I am sure that it is, but I'll check online. Checked.
Use double. Just remember: If you want to make it a double, then double will do it. Similarly, single will convert to a single precision number.
For those who might misinterpret my comment to think that double('1234') should also do that conversion, it is the one case I can think of where you need a different tool. There, you would use str2double.