LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find value in a table

I have a table, with two columns. Both column contains strings. The first one is an indicator, and the second one the value of this indicator. The format is like this:
indicator1 value1
indicator2 value2
How can I find in this table the string "inidicator1" and return the corresponding "value1"? thank you very much for your help
0 Kudos
Message 1 of 6
(3,881 Views)
Hi
Here are two simple solutions. See below attached file.
Download All
Message 2 of 6
(3,881 Views)
it's simple, if i think the same as you. a table is a two-dimensional array of strings. first split up your table in two 1d-arrays (one for 1st column, one for the 2nd). to search a string in the 1st column (index 0) use the "search 1d array" function which returns the index of the element. the second array contains the values. now use the function "index array" again to get the value.you understood?

best regards
Message 3 of 6
(3,881 Views)
Hi,

Here's a nice VI to do this.

(It's called "Look Up Table.vi", although that's a wrong name since a table
is always used for looking something up...)

Regards,

Wiebe.


"Esther.Lopez" wrote in message
news:50650000000800000068D80000-1079395200000@exchange.ni.com...
> I have a table, with two columns. Both column contains strings. The
> first one is an indicator, and the second one the value of this
> indicator. The format is like this:
> indicator1 value1
> indicator2 value2
> How can I find in this table the string "inidicator1" and return the
> corresponding "value1"? thank you very much for your help



[Attachment Look Up Table.vi, see below]
0 Kudos
Message 4 of 6
(3,881 Views)
Thanks!! I don´t have an array, I had a table, but after reading your answer I have changed it, and it works.
0 Kudos
Message 5 of 6
(3,881 Views)
Thanks!! finaly I changed the table and I put an array, but your solution also works
0 Kudos
Message 6 of 6
(3,881 Views)