LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Float point value

Solved!
Go to solution

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!

0 Kudos
Message 1 of 28
(5,329 Views)

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.

0 Kudos
Message 2 of 28
(5,324 Views)

For clarification.

 

Do you mean the display style on the graph?  this is independant of the precision of the value you scan.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 28
(5,323 Views)

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".

0 Kudos
Message 4 of 28
(5,322 Views)

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!

0 Kudos
Message 5 of 28
(5,311 Views)

Right>Click the graph select Properties and you get the property editor

untitled.PNG

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 28
(5,306 Views)

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!

0 Kudos
Message 7 of 28
(5,300 Views)
Solution
Accepted by topic author mlop
Don't confuse the inherent data of the wire with the cosmetic formatting.you see. Change the display format as already mentioned.
0 Kudos
Message 8 of 28
(5,292 Views)

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.

0 Kudos
Message 9 of 28
(5,289 Views)

Thanks for your boths responses!

 

As you explain I put a indicar to see it, and is correct!

 

Thank you very much!  Smiley Very Happy

 

 

0 Kudos
Message 10 of 28
(5,282 Views)