LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create an associative array?

I'm surprised LabView doesn't appear to have a built-in associative array type, where I can "index" into it by a key value.  Is it perhaps available but just by a different name?

 

0 Kudos
Message 1 of 5
(6,184 Views)
Maybe a cluster of two 1D String arrays (same size) would do what you want?  For instance, within the cluster is an array labeled Name and another array labeled Number.  You search the Number array for a certain entry, say 27, find the index and then index the Name array to find that the name Jasper is associated with the number 27.  Is this what you are looking to do?
0 Kudos
Message 2 of 5
(6,180 Views)

Yes, that's exactly what I was looking for.  I'm just surprised there's not a built-in VI to do this rather than rolling my own.  And I would think this is a common thing that folks would request ...

 

0 Kudos
Message 3 of 5
(6,170 Views)
There are some implementations available (like variant attributes or the OpenG dictionary package).

___________________
Try to take over the world!
Message 4 of 5
(6,149 Views)

Here is a anassociative array (map) that I just finished implementing using LabVIEW object-oriented programming (LabVIEW 2009). Use the test.vi method of the Map class to check out the functionality.

 

Feel free to use or modify it (according to the MIT license, see LICENSE.txt). If anybody is significantly improving or extending it, it would be great if you could post the updated ZIP file again in this thread.

Message Edited by dlanger on 10-30-2009 09:39 AM
Message Edited by dlanger on 10-30-2009 09:40 AM
0 Kudos
Message 5 of 5
(5,858 Views)