06-21-2011 10:32 AM
Hello,
I am trying to cast from a floating string (which I receive from VISA resource) to float value to send it to a graph chart. The problem is that I want more than one or 2 decimal precision but, I can't get it. I use the function "Scan value" to extract more than 2 as an example: I use the format string %.5f as a constant value connected to the block but with no succes.
Is it possible to get more than 2 digits? If yes, could somebody explain me how?
I would like to represent the value exact that I receive via RS232 (10bytes with 5 digit precision).
Thanks for your feedbacks!
Solved! Go to Solution.
06-21-2011 10:39 AM
Can you post a VI that shows what you are trying to do along with an example of the string you are trying to convert? If you are using %.5f, you should be getting 5 digits of precision.
06-21-2011 10:40 AM
For clarification.
Do you mean the display style on the graph? this is independant of the precision of the value you scan.
06-21-2011 10:40 AM
Show is your code containing a typical input string as diagram constant.
Most likely, all you need to do is change the display format of your numeric indicator. Have you tried?
Also try to keep the lingo straight. "cast" is not the right word when using "scan value".
06-21-2011 11:13 AM
hi,
I receive from VISA a value like 2.49252689 as an string. So, I want the same value but, in a float to allow me to represent it in the waveform chart and export to an excel file.
What do you mean saying: change the display format of your numeric indicator?
Attached you have my .vi.
Thanks for your feedbacks!
06-21-2011 11:27 AM
Right>Click the graph select Properties and you get the property editor
06-21-2011 11:37 AM
Thanks for your feedback!
But, the problem is that the output value of the block Scan Value only gives me 2 decimals precision (I have seen sing high light mode) and the input (string float) has 5. Clearly, tha value received by the WaveForm only is 2.
I mean, if the value received by VISA is 2.49635 the output of the blok (before the waveform chart) is 2.50 and I would like the same as VISA.
Thanks!
06-21-2011 11:59 AM
06-21-2011 12:05 PM
The output of the Scan From String is exactly 2.49635 if the input string is 2.49635. Put a normal indicator there or a probe and prove it for yourself.
06-21-2011 12:17 PM
Thanks for your boths responses!
As you explain I put a indicar to see it, and is correct!
Thank you very much!