LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

txt file to scale

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?

0 Kudos
Message 1 of 13
(3,484 Views)

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?

Message 2 of 13
(3,469 Views)

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

 

 


"Should be" isn't "Is" -Jay
Message 3 of 13
(3,463 Views)

Rather than a lookup table, you could also use Threshold and Interpolate to find the value.

 

Interpolate_Snippet.png

Message 4 of 13
(3,454 Views)

hi shane, thanks for your answer, let me try that.

0 Kudos
Message 5 of 13
(3,447 Views)

Shane, jamiva,

 

Close but, you missed a very nice feature of Threshold 1D Array

 

Capture.png.

 

 


"Should be" isn't "Is" -Jay
Message 6 of 13
(3,436 Views)

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?

0 Kudos
Message 7 of 13
(3,433 Views)

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)

0 Kudos
Message 8 of 13
(3,424 Views)

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

Capture1.png


"Should be" isn't "Is" -Jay
Message 9 of 13
(3,414 Views)

it worked!! thanks so much!!

0 Kudos
Message 10 of 13
(3,410 Views)