LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a sub vi whcih takes as input a cluster of arbitary size?

 Hi,
I have a vi in which I which I do different operation on the elements of the cluster and the cluster can have any number of elements of different types,
now I want to convert it to a sub vi which takes an cluster of arbitary size as input,
the problem is when i call it from some other vi and connect a cluster to it  gives error that cluster sizes are different
can somebody tell me how to do it?
i have attached the vi here
thank you
akash
0 Kudos
Message 1 of 4
(5,574 Views)
Short answer: you can't. You cannot create a wire to connect a cluster constant to a subVI input that is a cluster if the two clusters are not the same datatype. This is by design. The only thing you can do is to pass in a reference to the cluster and in your subVI you would need to walk through the list of controls, similar to what you're already doing.
0 Kudos
Message 2 of 4
(5,564 Views)
hi,
i tried to pass the reference but I am not able to do that,
how do i make the reference as the input,
also i tried to send an application reference from the other file
i am attaching both the files can u tell me how to proceed
thank you
akash

Download All
0 Kudos
Message 3 of 4
(5,555 Views)
You need to create a cluster refnum control. On your "Write Cluster to Matfile" VI, do the following:

  1. Go to the front panel
  2. Right-click, and go to the "Refnum" palette, and select the "Control Refnum" control. Place it on the front panel.
  3. Right-click on this new control and go to "Select VI Server Class->Generic->GObject->Control->Cluster->Cluster".
  4. Wire this control to your connector pane.
In the calling VI you need to create a block diagram reference to your cluster and wire this block diagram reference to the control reference input that was just created on your subVI.

Take a look at the attached example for a general idea.
0 Kudos
Message 4 of 4
(5,538 Views)