LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem reading strings from text file

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.

Download All
0 Kudos
Message 1 of 7
(2,653 Views)

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

0 Kudos
Message 2 of 7
(2,608 Views)

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.

0 Kudos
Message 3 of 7
(2,588 Views)

It can also be done in native labview. At least in your case. Like if you are not using a windows OS

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 7
(2,564 Views)

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.

0 Kudos
Message 5 of 7
(2,557 Views)

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

0 Kudos
Message 6 of 7
(2,544 Views)

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.  



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 7
(2,534 Views)