From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, ni.com will be undergoing 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: 

Help with Error 85 Scan from String (arg1)

Solved!
Go to solution

@billko wrote:

As an aside, something interesting happened to Scan from String in between LV 2015 and LV 2018.  It doesn't parse exactly the same.  I had a string that suddenly gave the ol' error 85 after updating the code from LV 2015 to LV 2018.  I admit that I was taking advantage of a "generous" interpretation of the help file, but it seemed to work.  Somewhere between LV 2015 and LV 2018, they must've tightened up the parsing.


Care to enlighten us what was the actual problem?

Rolf Kalbermatter
Averna BV
0 Kudos
Message 11 of 15
(244 Views)

@Bob_Schor wrote:

Try replacing all of your commas by spaces.  Scan from String with %s stops when it encounters a space (which can cause interesting things if your string, itself, has spaces!).  You can use the "Search and Replace String" function to do this, but be sure to enable the "Replace all?" option, the left-most of the top Connector inputs.  However, you need to "manually" replace the commas in the Format String with spaces, as well.  This will give you the result you want.

 

Bob Schor


I really like this solution, though my first attempt was to use the "spreadsheet string to array" node with a 1D-String-Array as type specifier an a comma as separator. In a second step every element would have to be converted "manually", element by element. I frequently use an own VI, that does this as well (and does it well), where a regex search pattern can be used as a separator. For your convenience I attached it.

Greets, Dave
0 Kudos
Message 12 of 15
(239 Views)

@rolfk wrote:

@billko wrote:

As an aside, something interesting happened to Scan from String in between LV 2015 and LV 2018.  It doesn't parse exactly the same.  I had a string that suddenly gave the ol' error 85 after updating the code from LV 2015 to LV 2018.  I admit that I was taking advantage of a "generous" interpretation of the help file, but it seemed to work.  Somewhere between LV 2015 and LV 2018, they must've tightened up the parsing.


Care to enlighten us what was the actual problem?


I wish I could find the code, but it had to do with how it interpreted white space before a number at the beginning of a string.  If I recall correctly, it used to throw out the white space and retrieve the number, but somewhere in between LV 2015 and LV 2018, it changed to be more strict and interpret it as a string + a number.

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 13 of 15
(218 Views)

So I wrote a little Test Scan From String Logic routine, then I discovered that my old PC that was running Windows 7 happily and had LV 12, 14, 15, and 16 installed, had been "upgraded" to Windows 10 (without my knowing about it), and (needless to say) LabVIEW didn't "reinstall itself".  I have tested this in LabVIEW 2016 and LabVIEW 2019, and it passes, and I'm attaching a Snippet "Saved for LabVIEW 2012" for someone (else) to test with an older version.

 

Based on Billko's recollection, the problem appears to be scanning numerics with leading spaces.  I took the string "123  456  789" (with two spaces between number groups) and built test three test strings with 0, 1, and 2 spaces before the first number.  I then built three more strings with only one space between the three groups.  I scanned each one with the format string "%d %d %d" which should scan three numerics, and created a 1 x 3 array of I32 for each test case.  I then test to see if all 6 (or more) strings are equal.  When tested with LabVIEW 2016 and 2019, the test passed (all 6 Arrays 1 x 3 arrays were equal).

Test Scan from String LogicTest Scan from String Logic

The attached VI was saved for LabVIEW 2012.

 

Bob Schor

Message 14 of 15
(206 Views)

Thank you everyone for the help. This works. I will try out other solutions and update everyone.

0 Kudos
Message 15 of 15
(190 Views)