From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a text file to an array, then extract a range of data points from it.

Solved!
Go to solution

I want to do the following steps:

 

1. Read from a text file and convert it to an array.

         My text files are with 2 colums, like this:

          1  1053

          1.3  1044

          1.5  2033 

          1.7  2444

          1.9  4335

 

2. Extract a range of data points from that array.

       I wanna give it an order to extract the data points that I want and output as an new array.

      The range starts when colum 1 value > 1.2, and end when colum 1 value < 1.8. (1.3 to 1.7)

      And extract the range of data from these two colums, so my expect result array is:

          1.3  1044

          1.5  2033 

          1.7  2444

 

Can anyone help me?

I'm a new user of labview haha, Thanks a lot!!!!

0 Kudos
Message 1 of 5
(5,621 Views)

"Read from spreadsheet file" (or "read delimited spreadsheet" for newer LabVIEW) will get you the data as a 2D array.

(Your post does not show the delimiter between entries. Is it a space or a tab character?)

 

To get a subset, use "array subset".

0 Kudos
Message 2 of 5
(5,611 Views)

altenbach 已寫:

"Read from spreadsheet file" (or "read delimited spreadsheet" for newer LabVIEW) will get you the data as a 2D array.

(Your post does not show the delimiter between entries. Is it a space or a tab character?)

 

To get a subset, use "array subset".



Thanks for ur quick response!

Do you mean the separation of colum 1 and 2 in the text file?

The separation between colume 1 and 2 in the text file is like this.

 

Thanks!

0 Kudos
Message 3 of 5
(5,609 Views)

@Ying88827 wrote:

The separation between colume 1 and 2 in the text file is like this.

 


OK, your column seperator is the tab character. This is the default, so you don't need to wire it.

0 Kudos
Message 4 of 5
(5,559 Views)
Solution
Accepted by topic author Ying88827

Again you still have not mentioned your LabVIEW version, but here's one simple solution.

 

Message 5 of 5
(5,523 Views)