ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan for string

Solved!
Go to solution

HI erveryone,

 

I am working with the Scan from String fuction, but I have a problem. The string that I have as input is "temp=32.2", so I am using the Scan function as follows:

 

snippet1.png

 

But as output 1 I have "temp=32.2" and 0 in the output 2.

 

Does anyone have an idea of how to separate "temp" in output1 and 32.2 in output2?

 

Thanks for your help

Raymundo Cassani
0 Kudos
Message 1 of 8
(3,863 Views)

Try a format of "%4s=%f"

0 Kudos
Message 2 of 8
(3,859 Views)

Thank you for early answer, but, what happens if my string is size-variable? I mean for some readings I have temp=32.2 for others something like: voltage=122.1,  current=12, or humd=51.2 

Raymundo Cassani
0 Kudos
Message 3 of 8
(3,855 Views)
Solution
Accepted by topic author rCassani

The you need to program around it, for example as follows. There are many ways to do this...

 

 

Message 4 of 8
(3,853 Views)

thank you

Raymundo Cassani
0 Kudos
Message 5 of 8
(3,846 Views)

Just make a small change to your format string, easy to do when you construct the format string from the dialog in the right-click menu.

 

ScanStringExample.png

Message 6 of 8
(3,838 Views)

he wants the leading string too, maybe....

0 Kudos
Message 7 of 8
(3,830 Views)

@altenbach wrote:

he wants the leading string too, maybe....


That sits in the first output. 

0 Kudos
Message 8 of 8
(3,826 Views)