LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting specific numbers from a text file?

Solved!
Go to solution

I have a text file with repeating sets of data.  Each is 4 lines long, with line 1 containing a title, line 2 containing a constant which identifies the data, line 3 has one number, and line 4 has two numbers corresponding to a max and min.  Is there any way I can extract the numbers from line 2, 3, and 4 separately to create an array for each?  So far, I've used read from text file wired into a FOR loop containing the scan from string function.  I'm not sure how to pick out every 4th line of the file to get common data grouped.  I'm new to Labview, so any advice is much appreciated!  Thanks.

0 Kudos
Message 1 of 6
(3,912 Views)

You should check this function:

Pick Line Function

 

If you can share the sample data file, probably someone can also suggest BETTER approach, just a possibility... !!


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 6
(3,907 Views)

@chazzchuzz wrote:

I have a text file with repeating sets of data.  Each is 4 lines long, with line 1 containing a title, line 2 containing a constant which identifies the data, line 3 has one number, and line 4 has two numbers corresponding to a max and min.  Is there any way I can extract the numbers from line 2, 3, and 4 separately to create an array for each?  So far, I've used read from text file wired into a FOR loop containing the scan from string function.  I'm not sure how to pick out every 4th line of the file to get common data grouped.  I'm new to Labview, so any advice is much appreciated!  Thanks.


You could use a for loop and use "Pick line" function. For each line, you could use the search/split string function. For line 4, it depends on how you have the numbers stored. Do you have a snapshot of the data ? That'd be helpful.


Kudos are the best way to say thanks 🙂
Message 3 of 6
(3,889 Views)
Solution
Accepted by topic author chazzchuzz

You can also use the Read From Text File VI and the Decimate 1D Array function.

 

Ben64

 

Extract Specific Values.png

 

As Moderator1983 said a sample of the data would be helpfull, are min and max separated by space, tab, comma. Do you want min and max in separate arrays? ...

0 Kudos
Message 4 of 6
(3,877 Views)

Thanks for the help!  The max and min are separated by a tab and I'd like them in separate arrays.

0 Kudos
Message 5 of 6
(3,866 Views)
Look and see how many people have requested a sample of your data. I guess you've gotten enough help and you should mark the thread as solved.
0 Kudos
Message 6 of 6
(3,858 Views)