Discussion:
search/replace string
(too old to reply)
HereWeGo
2008-08-14 18:10:08 UTC
Permalink
I am trying to read a specific amount of lines from a file and replace the the text {delimiter} with a tab using the search/replace string.  The problem is that the output of the read lines is a 1-D array of string and the sink of the search/replace string is a string.  How do I correct this?  I tried concatenate strings but then couldn't get the string back apart into lines.  I also tried reading characters but soon realized that the characters in the file to be read is variable.  Any ideas?
Dennis Knutson
2008-08-14 19:10:05 UTC
Permalink
What version of LabVIEW are you using? LabVIEW 8.x has no Read Lines function and the Read Lines in earlier versions does not return an array. Do you really mean Read From Spreadsheet File? The Read Characters is an older function and if you simply wire a -1 to the number of characters input, you get the entire file. Posting your code would help in understanding what the issue is.
HereWeGo
2008-08-14 19:10:08 UTC
Permalink
Here is my code.  I am using the read from text file vi with the read lines checkmarked.  Also attached is the file I am reading fromMessage Edited by HereWeGo on 08-14-2008 02:00 PMMessage Edited by HereWeGo on 08-14-2008 02:01 PMMessage Edited by HereWeGo on 08-14-2008 02:03 PMMessage Edited by HereWeGo on 08-14-2008 02:03 PM


my code.vi:
http://forums.ni.com/ni/attachments/ni/170/349400/1/my code.vi


048-7417_4A.txt:
http://forums.ni.com/ni/attachments/ni/170/349400/2/048-7417_4A.txt
Dennis Knutson
2008-08-14 19:10:09 UTC
Permalink
You can change it by unselecting the read lines mode and wiring a -1 to the count input. That will read the entire file. You can leave it as it is and wire the string array into a for loop with the Search and Replace inside the for loop.
HereWeGo
2008-08-14 19:10:10 UTC
Permalink
The problem is that it has to read exactly 34 lines and the 35th line has to be data.  The data output is going to be later scoped / analyzed in Excel.  Is this possible?
Dennis Knutson
2008-08-14 19:40:05 UTC
Permalink
Yes, as I already said. Did you read the entire answer? "You can leave it as it is and wire the string array into a for loop with the Search and Replace inside the for loop."
Loading...