LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting numbers from a file

Hi,

I have a text file with me which has 3 headers and then the data. The data initially has 5 columns of numbers and later only four columns of numbers.

Now I need to extract only the numbers that are in the 5 columns and stop when the 5 columns end because I dont need the numbers that are in the four columns after that.

Can any one help me in extracting the numbers in the five columns to an array.

I am including the text file here.

Thanks,
Ajit.
0 Kudos
Message 1 of 4
(2,794 Views)
Try this vi. It may be a bit slow because it reads line by line and builds an uninitialized array - but it seems to work. Hope it's helpful

Tim
Message 2 of 4
(2,793 Views)
Hi Tim, yes it was very helpful, but I am again stuck up with a problem.

I actually need to scan 6 columns instead of 5 and I managed to modify the program and it works.

But now once I have the array built using this VI, I need to scan the complete array and determine the maximum value in the fifth column. This value might occur more than once but I need to determine the maximum value. After I determine the maximum value, I need to scan the array again and obtain all the first two columns of the data corresponding to the maximum value of the fifth column and build a new array with that data.

i would be very thankful if you could help me in this regard.

Thanks a lot,
Ajit.
Download All
0 Kudos
Message 3 of 4
(2,793 Views)
Ajit,

Here's a modified version that does what I think you're after. It's fun to run into a Tecplot datafile again...

The crew here are very willing to provide examples, especially when they are requested with such precision. What you are up to--using LabVIEW as a general text-and-data manipulation tool--is a classic problem that LabVIEW works great for once you've become fairly expert with the built-in functions available, though you'll hear a lot of people swearing by perl or other more "traditional" tools.

I would encourage a lot of playing around with the string and array functions used in these examples until you really feel comfortable with everything on those palettes.

Regards,
John Lum
National Instruments
0 Kudos
Message 4 of 4
(2,793 Views)