LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read text file

Hi, I have a text file:

500 400
56 78 64 64
102 75 128 64
148 72 192 64

I want to read it and output to three array:
a[]= 56 102 148
b[]= 78 75 72
c[]= 64 64 64

I've done the code if the text file doesn't include "500 400"(attached). How to output "500 400" seperately?
Thanks.
0 Kudos
Message 1 of 4
(2,844 Views)
Thunderbird,

You can use a few additional array functions to strip off the first row of data and then grab the first two elements in order to display the items in the header row (see attached image of modification to your VI).

Regards,
John
0 Kudos
Message 2 of 4
(2,827 Views)
Simplest would be to split the string at the first "newline character" (or whatever separates your lines), then deal with the two sections separately.

Also note that you don't need to transpose your array, you can slice out colums by using the lower of the two indices of index array. (See attached example, LV 7.1)

(edit: also note that my "pattern" input is set to \-codes display. Because I don't have your data files, I have made your raw string the default value for easy testing. Add your file I/O as needed. :))

Message Edited by altenbach on 03-16-2005 11:04 AM

0 Kudos
Message 3 of 4
(2,825 Views)
That works great and more efficient then my former code. Thank you.
0 Kudos
Message 4 of 4
(2,788 Views)