03-16-2010 06:36 AM
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.
03-16-2010 06:46 AM
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?
03-16-2010 08:02 AM
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
03-16-2010 02:17 PM
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)
03-16-2010 02:23 PM
03-17-2010 02:18 PM
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,
03-18-2010 08:23 AM
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.
03-18-2010 08:36 AM
Hi Jaxon,
you can remove the -1 inside of the case structure.
Mike
03-18-2010 08:39 AM
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.