10-21-2011 09:52 AM
Hi,
I am using the read text vi to attempt to extract 4 sets of data from a text file and average them individually. In the vi attached, I attempt to create a string array from the text file, index by column to extract the data sets, then index subset at index 1 to filter out the text heading. Then I convert the fractional string array to a number array and average it, but I cannot seem to get it to work.
The .txt file has to be set up like this; there is another program creating the file.
10-21-2011 10:11 AM
Bear in mind that there are more headings than there are sets of data; the text headings are on one line only, they just wrap around
10-21-2011 10:28 AM
Your first problem is you have a Unicode text file, so you need to convert it to use the conversion tools you are using. If you look at the output of your file read, you'll see the null characters (represented by spaces in Normal view) in LabVIEW.
Look at this thread to convert the text.
10-21-2011 11:44 AM
It can also be done in native labview. At least in your case. Like if you are not using a windows OS
10-21-2011 11:49 AM
Coq's approach only works if you don't have any unicode characters in your file. If you know that this will never happen, then it's OK.
10-21-2011 12:14 PM
I am using windows, but I'd prefer to do it in LV if possible. I had some trouble getting the conversion vi in the unicode.llb to run properly.
The only characters that will ever be in the log file are the ones that are in the attachment. How can this conversion be done in LV?
Thanks
10-21-2011 12:39 PM - edited 10-21-2011 12:40 PM
Here is a even simpler way. If the text are as shown in the text file. That wil say only 8 bit ASCII code in UNICODE format.
@Matthew Kelton wrote:
Coq's approach only works if you don't have any unicode characters in your file. If you know that this will never happen, then it's OK.
Yes that is quite right.