09-14-2017 10:31 AM
Hi, i'm quite a begginer,and i have problem that i know it has a easy solution, but i can't figure it out.
I have a txt file with two columns and 10000 rows.
I need to use it as a scale(it would be the equivalent to lookup_value in excel,where the first column are the pre escaled value, and the second column is the actual scaled one)
I tried with the express scaling, but since the table to load is a lvm file, it won't read it.
Can any one help me?
09-14-2017 10:42 AM
Google tells me that function lets you lookup a number in a row and find it's corresponding number in another row. I would read the data from your file using "Read Delimited Spreadsheet.vi", I would then perform a search on the first column of the array using the "Search 1D Array.vi", then I would take it's index and index into the second column to find the value of the thing you want using "Index Array". Does that make sense?
09-14-2017 10:54 AM
You have attached a "Text" file a "LVM" is different.
In this case your columns are tab delimited with 9 digits of precision.
Read from Delimited file with a format specifier of %.9f and Transpose? = True
Index array to output t rows (the file columns)
Index and Bundle to provide an array of clusters of two doubles, or Points <x,y>
Threshold array to return the value of y at the index of x
09-14-2017 11:00 AM
Rather than a lookup table, you could also use Threshold and Interpolate to find the value.
09-14-2017 11:04 AM
hi shane, thanks for your answer, let me try that.
09-14-2017 11:19 AM
Shane, jamiva,
Close but, you missed a very nice feature of Threshold 1D Array
.
09-14-2017 11:24 AM
hi shane, i tried, but it has an error, when i try to connect the resulting spreadsheet to the "search 1d array", i'm attaching the vi,any ideas?
09-14-2017 11:53 AM
Thanks!
i did as you told me, but it doesn't return the number i need, for example, y tried with -117.3907001, and it should have return the number next to it (-5.98789879).
instead, it gave me a number that is close to the folowing number ofthe same column (-117.3519983)
09-14-2017 12:10 PM
two mistakes.
1) your fault. you cant transpose the array and wire 0 to index of column. you get a two by two array that way.
2) maybe a mistake in requirement. if you need the value of Y closest to X rather than the value of Y that would be at the fractional index of X you need to rfound down and index rather than interpolate
09-14-2017 12:23 PM
it worked!! thanks so much!!