Re: smart text read

2004-03-05 Thread Greg McKaskle
> I need to read from a text file that has over 2000 Two-Column entries.
> What I want is to have the user input a data number, i.e 150, and have
> a sub-vi search the file for that value and retrieve the associated
> column with that value. However, since it is a big file, there needs
> to be an optimized way to search the columns. If I design some logic
> to "smartly" send the data range to search for, is there a strap on
> sub-vi that will work in this case, or will I have to modify an
> existing one from the toolbox?
> 

The first thing to determine is, is that really a big file.  You don't 
mention a file size, but 2000 times two entries of say five characters 
apiece is 20Kb.  If the string you read from file isn't more than a 
megabyte or two, just read the whole thing in as a spreadsheet string 
and use the LV array functions to slice, search, etc.

If I'm misunderstanding your description, and your file is indeed too 
large to read into memory, then you likely want to make sure you are 
using the lower level File I/O nodes, the yellow ones, for open and 
read.  They are capable of returning info from random places in the file 
so that you can do a binary lookup to locate a record in an ordered 
file.  They will only pull in the records you are asking for.

Again, though, if you are going to wind up pulling in the entire file 
anyway, don't bother reading it this way.

Greg McKaskle




smart text read

2004-03-04 Thread merp382
I need to read from a text file that has over 2000 Two-Column entries.
What I want is to have the user input a data number, i.e 150, and have
a sub-vi search the file for that value and retrieve the associated
column with that value. However, since it is a big file, there needs
to be an optimized way to search the columns. If I design some logic
to "smartly" send the data range to search for, is there a strap on
sub-vi that will work in this case, or will I have to modify an
existing one from the toolbox?

Thanks,
David