LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Select a column and Search a range of values in each column

I have a text file with a lot of columns.

I have a program that reads the txt file, but i do not know how to select a range of values to search within that particular column.

for example, if my values were 

10   5     3

15   6     4

20   7     5

30   8    10

10   9    20

i want to find all values ranging from 0-10(including 0,10) in column 1. Once I find how many numbers are withing that range, i want to use that to search the other columns were the ranges were met.

0 Kudos
Message 1 of 9
(5,173 Views)

Jaxon wrote:

 

Once I find how many numbers are withing that range, i want to use that to search the other columns were the ranges were met.


Can you explain this in bit detail please. In your example, you have 2 times 10 occured in the first column. After that what you want to do with the other columns?

0 Kudos
Message 2 of 9
(5,170 Views)

Hi Jaxon,

create an array of your data. You can then use the index array or array subset function to get parts of it. If your array is of type "numerical" then you can use the "In Range" function to get your values.

 

Mike

Message 3 of 9
(5,160 Views)

Example:

10  5  6  7

3    2  6  8

10  2  3  2

5    9  9  8

10  4  6  5

 

 

Lets say i have this array and i want to search any column the user chooses, either column 1 or 2 or 3 or 4  (how do i do this?)

I am able to select a single column and use the "in Range" function to search for value i want. The boolean output shows if those values are there or not. How do i convert the boolean array to a value array? ( I am searching for 10 and i know that 10 occurs 3 times in that column. the boolean array lights up three times, but how do i convert this into a array which shows the complete row in which 10 was found. ( i want to see (10,5,6,7     as my output)              

                                   10 2 3 2

                                   10 4 6 5)

 

0 Kudos
Message 4 of 9
(5,137 Views)

Hi Jaxon,

see this link. In Range can also work with the same value for upper and lower limit.

 

Mike

Message 5 of 9
(5,134 Views)

Hi Jaxon,

 

I believe what you are looking for is the Index Array function and/or the Array Subset function on the Array palette, and then the Max/Min function on the Comparison palette. 

 

Cheers, 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 6 of 9
(5,103 Views)

thanks for all your help.

Mike, i tried using the link you had provided but during the final portion of the program on the case structure. after i run the program i seem to be one row short. For example if it finds 5 values that are in range and the output only provides for 4. It does not show the last row. how to do i solve this issue.

 

 

 

 

0 Kudos
Message 7 of 9
(5,084 Views)

Hi Jaxon,

you can remove the -1 inside of the case structure.

 

Mike

0 Kudos
Message 8 of 9
(5,078 Views)

thanks for help, i figured it out. the issue was the (-1).

 

is using a while loop or for loop better, if i do not want to sort the data first.

the search 1d array stops after it finds the first match, so how do i best search all the data set without sorting the data.

0 Kudos
Message 9 of 9
(5,077 Views)