LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass array of any type to subVI (array of clusters)

I want to build a subVI to perform some array operations - regardless of what the arrays are, how do I make a subVI to accept an array of any type? The array's I'm passing are array's of clusters...and I have over a dozen different array's of clusters.

 

This would be similar to most of the array functions built into the LV pallett that accept any type array.

 

Any thoughts?

0 Kudos
Message 1 of 5
(3,532 Views)

Look at Polymorphic VI Window.

 

http://zone.ni.com/reference/en-XX/help/371361H-01/lvdialog/polymorphic_vi_dialog_box/

 

A polymorphic VI is basically several VIs all in one subVI.  Based on the data type passed in it will select the VI that matches the data type.

 

This may be a good starting point

http://zone.ni.com/devzone/cda/epd/p/id/3229

 

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 2 of 5
(3,521 Views)

I'm familiar with polymorphic VI's, however I don't see how they would save me time. I'm dealing with rather complex arrays of clusters. I would have to create an instance for each type of cluster I've made, and would have to create new instances every time I make a new array of clusters.

 

Within my subVI, I don't need to perform operations on data within the elements, I just have to be able to select and/or reorder elements. That's why I want a generic input/output type.

 

Ex...the built in "Index Array" fuction in Labview accepts any type of array, yet it doesn't "know beforehand" what my array of clusters looks like, and certainly doesn't contain cases to handle every possible array of clusters. How is that done?

0 Kudos
Message 3 of 5
(3,498 Views)

Can you convert it to varient and pass that in?  You can covert back to native type inside subVI.

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 4 of 5
(3,479 Views)

wrkcrw00 wrote:

Ex...the built in "Index Array" fuction in Labview accepts any type of array, yet it doesn't "know beforehand" what my array of clusters looks like, and certainly doesn't contain cases to handle every possible array of clusters. How is that done?


It's done by being a built-in function - a fundamental part of the language - rather than constructed out of other LabVIEW components.  There's not a lot you can do easily to duplicate it.  However, if you just need to accept an array of any type but do not need too much access to the data contained in individual elements, you can create a control that is an array of variants, and wire an array of any type to it.  You could then extract a subset of elements, for example, and return them as an array of variants, then convert that back to your desired data type.

0 Kudos
Message 5 of 5
(3,478 Views)