LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The quickest way to search a 2D array for matching

Solved!
Go to solution

this file is older version, how i should open this? any suggestion

0 Kudos
Message 11 of 20
(2,238 Views)

Hi sam,

 

when the VI is created with an older LabVIEW version than the one you have installed you can simply open it with your LabVIEW!

(As long as the old VI is not older than LabVIEW7 or 6…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 12 of 20
(2,230 Views)

could you please convert it to for me. i tried many times but i didn't converted. Thanks

0 Kudos
Message 13 of 20
(2,188 Views)

@sam67 wrote:

could you please convert it to for me. i tried many times but i didn't converted. Thanks


To quote GerdW, 

 

(When you want something else you should ask more specific!)
aputman
0 Kudos
Message 14 of 20
(2,170 Views)

Hey sam67,

 

Is it maybe the other way round? altenbach's file Match_in_case_struct_MODCA.vi is stored in LabVIEW 2017 format and opens perfectly fine in LabVIEW 2018. Please let us know which version you are using and what error message you get. Otherwise helping or even converting it (to what?) is impossible.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 15 of 20
(2,147 Views)

Hello altenbach,

 

I just noticed you demo code does not work as intended (the algorithm itself is fine and neat though!):

 

The first row of the string array and variant names are a single character each, whereas the string that comes from the Front Panel Control contains a LF as well. Get Variant Attribute cannot find "A\n" for "A" and therefore returns "<not found>" all the times.

 

Just in case anyone needs this: Either removing \n from the input string, or (worse) adding \n to each of the variant attributes names would solve this. In case you are not using a String Control, but a constant on the Block Diagram, the example works as posted.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 16 of 20
(2,140 Views)

@ikaiser wrote:

The first row of the string array and variant names are a single character each, whereas the string that comes from the Front Panel Control contains a LF as well. Get Variant Attribute cannot find "A\n" for "A" and therefore returns "<not found>" all the times.


(Sorry, reviving an old discussion. Did not notice your comment earlier)

 

No, my string control is se to "limit to single line", so it is not even possible to enter a newline character via keyboard. Now sure how you even get a newline character in there.

 

Ah noticed that the default value for the string is \n, that needs to be corrected!

 

In any case, all this should be done using Maps now (LabVIEW 2019 and newer).

0 Kudos
Message 17 of 20
(1,721 Views)

Hi,

I don`t realy undersatand the problem that you face , but if you want to search an items in a 2 D array, you find below a vi.

 

Emna20_0-1650337278388.png

Best Regards,

thank you.

kudos 🤗

 

0 Kudos
Message 18 of 20
(1,708 Views)

@Emna20 wrote:

Hi,

I don`t realy undersatand the problem that you face , but if you want to search an items in a 2 D array, you find below a vi.

🤗


I agree that you did not understand the problem of this old discussion and your VI solves a very different problem.

 

"Search array" scales with O(n) while lookups in maps (or variant attributes) scale with O(log2(n)),  and are thus many orders of magnitude faster for large datasets.

Message 19 of 20
(1,704 Views)

Hi altenbach,

long time no see (-:

 

Thanks for your reply despite reviving the zombie thread - default values are a tripping hazard in every programming language I know 🤷 So it's good you gave the hint on the issue in the demo code. And the update towards Maps.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 20 of 20
(1,670 Views)