LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comparison of 2 1D string arrays

Solved!
Go to solution

Hello NI community,

 

Attached is a LabVIEW 2018 SP1 application in which 2 1D arrays of string are compared. If they match, then an array of indices is generated. In this application, the array of indices should be 57, 56, and 170 in order.

 

However, I only get the index of 170. I would appreciate your help in solving this minor problem.

0 Kudos
Message 1 of 10
(2,217 Views)

Change the tunnels of the inner for loop to a shift register, as you have for the outer for loop.

0 Kudos
Message 2 of 10
(2,207 Views)

You don't need any shift registers at all.

Use the "advanced" tunnel modes already available with your LV2018 version:

Best regards,
GerdW


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

Assuming that the elements in the master array are unique and each selected exists (If it does not, you'll get -1), all you need is the following:

 

altenbach_0-1609696601641.png

(the function is "Search array". btw. I don't understand the purpose of your flat sequence.)

 

0 Kudos
Message 4 of 10
(2,179 Views)

Thanks for your help, GerdW & UliB

0 Kudos
Message 5 of 10
(2,168 Views)

Thanks, altenbach

 

0 Kudos
Message 6 of 10
(2,165 Views)

Hello altenbach,

 

Attached is an updated version "2021_01_03_string_comparison_01.vi" in which the array of master item codes is embedded in a tree control. If an item code is selected, then it becomes disabled.

 

I would appreciate your help in getting the last item code in the tree control disabled. Thanks.

By the way, I hope you understand the purpose of my flat sequence structure.

 

0 Kudos
Message 7 of 10
(2,104 Views)

cha@bellflight.com wrote:

By the way, I hope you understand the purpose of my flat sequence structure.


No I don't understand the purpose of your flat sequence!!! You code would work identically if you remove the flat sequence because all important execution orders are fully determined by dataflow principles.

 


cha@bellflight.com wrote:

Attached is an updated version "2021_01_03_string_comparison_01.vi" in which the array of master item codes is embedded in a tree control. If an item code is selected, then it becomes disabled.

 

I would appreciate your help in getting the last item code in the tree control disabled. Thanks.


Sorry, it is not clear what you want. First you say you want the selected item disabled then you say you want the last item disabled. Are these the same or different things? What is the order of items (first/last/etc.)? Don't you need a loop and e.g. event structure to tell when selections change? To react to user interactions?

0 Kudos
Message 8 of 10
(2,101 Views)
Solution
Accepted by topic author cha@bellflight.com

Maybe all you really need is a listbox?

 

altenbach_0-1609780385356.png

 

 

Message 9 of 10
(2,092 Views)

Thanks, altenbach, for your help,

 

I still use tree control in conjunction with an event structure in a WHILE loop, and get all 3 item codes, P00016, P00017, and X00028 disabled!

 

0 Kudos
Message 10 of 10
(2,089 Views)