08-30-2018 12:38 PM
Hi guys,
I have attached the code I am having problem with. The code will have a csv file as an input which have header lines and space in between lines and lines that start with words and lines start with numbers with. I was able to get the code to out put a text file that will take out the header lines, spaces, and lines that starts with words and only out put the phrase programmed successfully, or error. For some reason I have to run the code twice in order to get expected out put. This code was built using examples from the forum. I have included the code and the csv file that you need to run through the code . please put the csv file in C:\temp. and run code the outut will be final.txt in C:\temp
Solved! Go to Solution.
08-30-2018 01:45 PM
08-30-2018 01:56 PM - edited 08-30-2018 01:56 PM
You have a race condition between writing your first file and reading it. My suggestion is to not read the file you just wrote, but use Spreadsheet String To Array to convert the original string to the array of strings you expect.
In fact, we can eliminate all of the file IO in the middle since we already the the data.
That last FOR loop can be eliminated with a simple Index Array (wire a 6 to the column input).
You can right-click on the Read Text File and choose to Read Lines. Set the count to -1 to read all of the lines and you now have a 1D array of strings that correspond to the lines. Now you can use a much simpler FOR loop instead of your While loop.
08-31-2018 09:29 AM
Thank you very much, I knew I was doing something wrong and you had done it perfectly and you made me aware of my issue and introduced me to a function that I did not know it exists in Lab view the Decimal Digit? Function. Thanks and have a great weekend