LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

indexing array of references element by element

Solved!
Go to solution

Hello,

 

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
(3,374 Views)

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
(3,371 Views)

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
(3,357 Views)
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
(3,347 Views)
Solution
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
(3,346 Views)

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
(3,340 Views)