convert fixed point to real data
98 views (last 30 days)
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?
Massimo Zanetti on 15 Mar 2017
Does this help you?
a = sfi(pi);
%convert to double
d = double(a)
John D'Errico on 15 Mar 2017
Edited: John D'Errico on 15 Mar 2017
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.