01-29-2020 10:35 PM
I have two different measurements going into the function but it always gives me 0. I'm actually using Highlight Execution and watching the numbers go into and then coming out be 0 always. Kinda tearing my hair out because it doesn't make any logical sense. I know it's kind of a big VI so in order to make it easier, I'm just focused on that one switch case to the far right and then the call to Frac/Exp String to Number vi.
01-29-2020 11:23 PM
Comma for a decimal point, maybe?
01-29-2020 11:25 PM
What does the actual string look like going into the function?
Whenever I hear someone with a problem like this, I'm suspect a problem with their string where they are using a European comma as a decimal separator rather than a real decimal point. Could this apply to you?
If so, use Scan From String with a format code of %,;%f which will allow the function to interpret the comma as a decimal point and give you the digits after the comma as the fractional part of the decimal.
01-30-2020 07:05 AM
@RavensFan wrote:
What does the actual string look like going into the function?
Whenever I hear someone with a problem like this, I'm suspect a problem with their string where they are using a European comma as a decimal separator rather than a real decimal point. Could this apply to you?
If so, use Scan From String with a format code of %,;%f which will allow the function to interpret the comma as a decimal point and give you the digits after the comma as the fractional part of the decimal.
Fractional/Exp to String also has an option to use system decimal point T/F. I think that will work, too.
01-30-2020 07:28 AM - edited 01-30-2020 07:29 AM
@billko wrote:
@RavensFan wrote:
What does the actual string look like going into the function?
Whenever I hear someone with a problem like this, I'm suspect a problem with their string where they are using a European comma as a decimal separator rather than a real decimal point. Could this apply to you?
If so, use Scan From String with a format code of %,;%f which will allow the function to interpret the comma as a decimal point and give you the digits after the comma as the fractional part of the decimal.
Fractional/Exp to String also has an option to use system decimal point T/F. I think that will work, too.
True, but only sometimes. Tere are many situations where it doesn't. Like if you are using a string that contains commas, on an regular PC that the OS is defined for decimal points, then whether you wire in a False or use the default True, the output is the same either way in that the portion after the decimal point or comma is dropped.
Scan from String gives explicit control.
01-30-2020 09:30 AM
@billko wrote:Fractional/Exp to String also has an option to use system decimal point T/F. I think that will work, too.
It will work as long as your system matches the string's format. For this reason, I also prefer using the Scan From String.
01-30-2020 09:35 AM
Thanks for that info!