From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

floating point values using "scan from string"

Hello,

I wanted to grep vales from a string 

"$PRISTY,1,-1,6553,25.3,0,,,,0*1D3B"

I basiclly wanted first 5 values. (1 -1 6553 25.3 0)

 

If i use scan from string with match pattern $PRISTY,%d,%d,%d,%f,%d  ---> i get "error 85"

 

I can grep first 4 values, using $PRISTY,%d,%d,%d,%f  ----> but the fourth value i get is just 25 and not 25.3.

 

I think there is problem in greping floating point values.

0 Kudos
Message 1 of 2
(2,480 Views)

Works fine for me. Maybe your local settings use the comma as decimal separator?

Try prepending %.; to the format string, i.e. use %.;$PRISTY,%d,%d,%d,%f,%d

 

Message 2 of 2
(2,450 Views)