LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Error 85 Scan from String (arg1)

Solved!
Go to solution

Hi,

I am new to Labview and created a VI that reads data from a serial port. I am using VISA read function and my expected data stream has the following format:  A,+000.00,+000.00,M,+022.21,00,3A.

After the Read VISA, I have a Scan from String function. But when I try to run my labview VI it gives me Error 85 Scan From String (arg1). I have the following format for this arg: %s,%f,%f,%s,%f,%f,%x. Could someone let me know where I have it wrong?

 

Thank you.

0 Kudos
Message 1 of 15
(3,139 Views)

No.

 

But if you attached your VI and saved the string you received from your device as default data in either a string constant, control, or indicator,  then we might be able to figure how where you went wrong.

0 Kudos
Message 2 of 15
(3,123 Views)

"%s", a string, matches everything including commas, therefore it never stops, therefore there is nothing after it to scan.

 

If you change your two "%s" instances to "%1s", that tells them to scan exactly 1 character, and it should work.

0 Kudos
Message 3 of 15
(3,108 Views)

Because the comma following the "A" is also a string, and everything else after the comma can be interpreted as a string, it scans the whole line into your first output and then scratches its head because it can't find the comma!  You have to specify that it only reads one character (the "A") and then you'll be okay.  Do the same for all your fixed-width strings.

 

Or, you can treat it as a comma-delimited string, index each element and work on them separately...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 15
(3,107 Views)

@Kyle97330 wrote:

"%s", a string, matches everything including commas, therefore it never stops, therefore there is nothing after it to scan.

 

If you change your two "%s" instances to "%1s", that tells them to scan exactly 1 character, and it should work.


You beat me to it.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 15
(3,106 Views)

Hi,

I tried your solution. It still does not work. 

0 Kudos
Message 6 of 15
(3,084 Views)