Showing results for 
Search instead for 
Did you mean: 

indexing array of references element by element

Go to solution



I have a simple question. How do I go about indexing an array of references element by element? For example, when using a cluster reference, there is a property node called "controls [ ]" that we can pass into a for loop. For a normal array, "enable indexing" is usually automatically turned on when entering a for loop. Why is it that for an array of references, this is not the case? Thanks for the help.

0 Kudos
Message 1 of 7

Your screenshot is hiding what you are trying to do.


Looking at the thickness of your green wire, it doesn't seem to be an array but a single value.  So rather than an Array of References, you have a single reference.  Perhaps a Reference to an Array?


If you posted a .vi, we can see the front panel and the hidden part of your code.  You mention a cluster reference or "controls[]" property node, but I don't see where that shows up in your code.

Message Edited by Ravens Fan on 03-26-2009 11:21 PM
0 Kudos
Message 2 of 7

Hi Ravensfan,


Sorry about that. I meant to attach the code along with the image. You're right, the reference I am using is a single reference to an array. I want to know if it is possible to achieve the same outcome as it is when using multiple references. Specifically, how do I go about indexing each element in the array while still using the invoke method? Is this even possible?


0 Kudos
Message 3 of 7
ok, I think I found a solution. There's a vi called "Picture to Pixmap" which will let me get back the image data. Thanks again for the help.
0 Kudos
Message 4 of 7
Accepted by Newbie217

Up top you are working with a reference to a picture array.  Down bottom you are working with an array of references to individual picture controls. 


Seems like you are making this more complicated than it needs to be.


You can use Picture to Pixmap function to get the image data.  And just auto index the pictures come from the array of pictures.

Message Edited by Ravens Fan on 03-27-2009 12:36 AM
Message 5 of 7

Ravens Fan,


That's exactly the solution I ended up using! I wasn't too familar with using pictures, so I was unaware that there was a "Picture to Pixmap" vi.  Say we were to remove this vi, would it still be possible to obtain the same results? Just from an understanding point of view, I'm wondering what we would have to do. Thanks very much.

0 Kudos
Message 6 of 7

Since the Get Image is a method, it has to work on something, and that would be a picture control or indicator.  (If you look at the Get Image Method for the array, you'll notice it only returns an image of the front panel object, so I think you'd just get a picture of the array as it looks on the FP).


So you'd send the picture to an indicator, then use the Get image method on that indicator immediately afterwards.  See attached.  I didn't try this out so I can't be sure it would work, but I think it would.  But it would still be a major hack compared to just using the Picture to Pixmap VI.

Message Edited by Ravens Fan on 03-27-2009 01:03 AM
Message 7 of 7