LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 85 at Scan From String

So I have a spreadsheet string that has the following line somewhere.  The value changes so I want to extract it.

 

IndexedValues=1.000000E-3;

 

So I use scan from string with the following as the format string "IndexedValues= %e"

 

I have tried the following, all which give error 85 (string doesnt match), so I am extremely confused.  This is just one number to be extracted.

"IndexedValues= %e"

 

"IndexedValues= %e;"

 

"IndexedValues= %f"

 

"IndexedValues= %f;"

0 Kudos
Message 1 of 9
(2,913 Views)

%f should be sufficient. Can you attach a simple VI that contains a few typical string as diagram constant. Could it be there are hidden characters (nonprintable, tabs, etc.).

 

(You could just search (using match pattern) for "=" and scan the "after substring".)

0 Kudos
Message 2 of 9
(2,900 Views)

Thanks for the idea of searching.  If I match IndexedValues=, it works perfectly.  I guess the file probably has something hidden.

0 Kudos
Message 3 of 9
(2,892 Views)

If the hidden characters are always the same, just get one input string, create a constant from it, replace the number string with %f, and use it as format, leaving all the rest as is.

 

(Also use \-codes display to see what's actually there.)

 

If the string is well formed, all your formats should just work:

 

scanIt.png

0 Kudos
Message 4 of 9
(2,886 Views)

In your example above the expected string is "Value=1.0" while your input to the ScanString is "Value= %f". If you noticed, you included a space character in your scan string.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 9
(2,872 Views)

@Mark_Yedinak wrote:

In your example above the expected string is "Value=1.0" while your input to the ScanString is "Value= %f". If you noticed, you included a space character in your scan string.


That space does not matter:

 

scanItSpace.png

Message 6 of 9
(2,857 Views)

What about using "%.;IndexedValues=%f" as format string if you know that the input string always will use a decimal point rather than a system depending decimal character? 

 

What most likely happens is that your system has a decimal comma as local decimal character configured. The Scan from string looks for that, doesn't find it and stops at the decimal point since it can't be part of a floating point number, returning 1,0 as value. Then your format string contains a literal semicolon which doesn't match with the decimal point in the string at the current scan position and hence error 85.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 9
(2,811 Views)

@jmaslek  a écrit :

So I have a spreadsheet string that has the following line somewhere.  The value changes so I want to extract it.

 

IndexedValues=1.000000E-3;

 


Scan From String needs to know the exact format of the input, if you have other text before what you're looking for you will get error 85. Use Match Pattern.vi instead.

 

Ben64

0 Kudos
Message 8 of 9
(2,795 Views)

@rolfk wrote:

What most likely happens is that your system has a decimal comma as local decimal character configured..


Since starting scanning after finding the "=" solved the problem, localization was not the issue, but sill something to keep in mind.

0 Kudos
Message 9 of 9
(2,777 Views)