LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan from string error 85

Hi Everybody,

I'm trying to use LabView to process some data.  The data, although it was collected via labview, has been written out to csv file format.  I have been able to successfully open the file and use the search split string function to remove the "header" from the data stream.  Now I'm trying to parse the header to extract some pieces of the info that is there.  I'm trying to do this with the Scan from String VI.  

So far I've been able to retrieve the Specimen ID from the first line of the header by setting the format string input of Scan from String as "Specimen ID ,%s", which works just fine.  Problem is, when I adjust the format string to include the next piece of data I want, I inevitably get an Error 85, which is a failed scan.  In fact, I get an err85 every time I try to extract something from after the second line.  I've attached a VI in which I cut and pasted an example header string in as a string constant and an example of how I'm trying to extract the values.  I've tried playing around with spaces and different formats, but get the err85 no matter what I do (unless I extract the first line).  I have a hunch that it has something to do with the EOL marker, but no idea how to work around it.

A search of posts here show that a lot of people have issues with the scan from string vi, but nobody I could find had this exact problem.  I've also considered using the spreadsheet spring to array function, but because I have a mix of commas and EOLs it doesn't seem to work either. HELP! I really don't want to have to write this over in VBA/Excel.

Thanks,
Turk

Message Edited by YoungTurk on 07-29-2005 10:36 AM

Message 1 of 4
(4,143 Views)

I believe the Scan from String only works with single line strings.

If the data you are trying to isolate is everything after the comma, you can use the spreadsheet string to array function but use a comma as the delimiter instead of the default tab and the format string as %s (to specify strings).  If you need any of these numbers as a number format, you can then use the string to number conversion vis.

Message Edited by tuned99 on 07-29-2005 11:05 AM

Message 2 of 4
(4,131 Views)
You should probably parse it line by line (See attached, LabVIEW 7.1)..
 
The attached example shows one possibility to get all the Items and values out. Not all values are strictly numeric so you would need to adapt the code a little bit. (This is just a very rough 1 minute draft). 😉
 
You might want to cosider to extract all values into a cluster for further processing, Have a look at the example  posted in this thread . It can be easily adapted to read the values in the proper format (DBL, I32, Date, String, etc.) depending on the item name.
 
Good luck!
 
🙂
Message 3 of 4
(4,124 Views)
Alright!  I've got it now. Smiley Surprised As usual, I feel a bit silly for not figuring this out on my own, but I guess that what this forum is all about.  My solution is a mash up of both ideas, so 5's for both of you.  I was having an awful hard time figuring out the scan string for tokens VI, but now I get it.  I've chosen to write my whole header into a string array, and then parse it out as need be.  It also never occured to me to set up the delimiters input as an array, clever.

Thanks a ton,
Turk

Sorry, still figuring out the buttons here, this is a reply to both messages.

Message Edited by YoungTurk on 07-29-2005 12:07 PM

Message 4 of 4
(4,113 Views)