LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to compare one by one element of one column with other table's first column ??

Solved!
Go to solution

Hello,

 

I Have two files one file has only Id numbers and second file has table with for example 4 column, and its first column has Id number.

So I want to compare the first element of the ID file with the 1st column of the table file's  all elements of that column until it find the matches.

If compare match then LED will be ON other wise LED will be OFF.

Here in attachment I have attached the both file.

Please guide me how can I do the same.

 

Thank you very much in advance.

 

Download All
0 Kudos
Message 1 of 21
(2,699 Views)

Hi Ankit,

 

some pseudocode:

FOR EACH id
  Search1DArray(id in 1st column of table)
  IF found THEN set LED=ON ENDIF
NEXT

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 21
(2,687 Views)

Thank you very much For your reply.

 

I tried with  same logic, but I have one problem that How can I stop or break the For loop when condition is true. 

For example in my case if id is match then I want to stop the For loop.

 

Here in attachment I have attached that vi.

Thank you very much For your help.

 

With Greetings,

Ankit.

 

0 Kudos
Message 3 of 21
(2,655 Views)

I am not sure If I understand well but maybe it will be helpful.

 

 

Duro

Duri
0 Kudos
Message 4 of 21
(2,651 Views)

Thank you for your reply can you please upload the vi in older version as I am using labview 12.

I want to break the for loop, means when its comparision true then its break the loop. 

 

Thank you very much for your time again.

 

Akki.

0 Kudos
Message 5 of 21
(2,648 Views)

In LV 2012, hope it is ok now.

Duri
0 Kudos
Message 6 of 21
(2,643 Views)

Thank you very much For your answer.

 

Is it possible to compare the array with single element.??

For example: this table 

                         ID      X       Y

                        10    2.1    3.43

                        11    3.4    4.3

                        12   4.12   5.4

 

and If user enter number  12 then 12 will be compare with the all element of the first column, if  match then LED will be on and display all the element of the that column other wise LED OFF. 

 

Thank you very much once again for your help.

0 Kudos
Message 7 of 21
(2,608 Views)

 

 

 

you can try something like this if you want to stop at the first found ID.

 

you will display conditional terminal on the for loop by right click on the border of for loop and selecting conditional terminal.

 

in the table 2 you will get the array with ID and rest of the data in that row.

 

but if you will have more rows with the same ID, this solution will get you only the first one.

 

 

 

Duri
Message 8 of 21
(2,600 Views)

Hiii,

Thank you very much for your reply.

sorry for again taking your time can you please upload this vi in some older version as I am using lV 2012.

 

Thank you very much fór your time.

 

0 Kudos
Message 9 of 21
(2,591 Views)

Yes, sorry, I forgot again.

 

 

Duri
Message 10 of 21
(2,589 Views)