LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining reference to cluster with no indicator

Hello all,

 

I am trying to create a program that passes in a cluster of plots to a subvi that accepts generic controls. The reason for this is the number of elements in the cluster may change and I want to create a modular subvi that does not always break the connector pane. I'm guessing an array would actually be a better solution for this example, but in any case I want to see if there is a way to get this specific program working.

 

 The subvi then converts this generic control to a cluster control using the "to more specific class" function. Using property nodes, I can then index each element and obtain the data information I want.

 

The problem I am running into is that I receive the ERROR 1057 each time I try to convert the generic control into a cluster control. I am first typecasting the cluster and I'm pretty sure I am doing this incorrectly. I'm not sure how to go about fixing this as I have minimal experience using typecasting functions. I do notice that if I first create an indicator for the clusters, then i can easily convert this indicator to a more generic class, and pass this into the connector pane with no problems. For my application, I would like a way of obtaining a reference to a cluster without having to create an indicator each time. Hopefully there's an easy solution to this problem. Thanks for the help!

Download All
0 Kudos
Message 1 of 8
(2,993 Views)

You're way off base here, with serious round-peg, square-hole issues.

 

First, a GRAPH is a thing on the front panel, which displays one or more PLOTs.  There's no such thing as a reference to a plot.

 

When you bundle the three graph refs (upper left), you have a data structure with three items in it. 

When you cast that to a single control ref, you throw away most of the data.

 

By definition, a cluster is for a fixed number of various type items.

By definition, an array is for a variable number of identical items.

 

If you want to pass a variable number of graph refs to a subVI, then build an array using the refs, and pass it.

You are fighting the system, instead of letting it work FOR you.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 8
(2,965 Views)

Instead of passing in a cluster of references, try passing in an array of references.  Then you won't need the typecasting at all.

 

As for your question "Is there a way to obtain reference to a cluster that has no control?"  Well, sort of.

 

First of all,  a control reference is a reference to a specific front panel object.

 

That being said, you can put one on the block diagram by selecting (from the function palette) Programming-->Application Control -->Class Specifier Constant  and then from the object menu, select Select VI Server Class -->Generic-->GObject-->Control-->Cluster... but I'm not really sure what (if anything) that would get you.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 3 of 8
(2,962 Views)
For the record, I was distracted in the middle of writing my post and did not see Steve's.  Great minds think alike.  So do mediocre ones...   🙂
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 4 of 8
(2,960 Views)

You can't create a reference to an object that doesn't exist.  A control reference points at a specific front-panel object (control or indicator), not to data.  Your typecast tells LabVIEW to treat the cluster data as if it were a reference, but since that reference is garbage and doesn't point at anything, LabVIEW gives you an error.

 

EDIT: looks like Matt beat me to it (same phrasing, even!)

Message Edited by nathand on 03-26-2009 05:46 PM
Message 5 of 8
(2,956 Views)

Great minds think alike.  So do mediocre ones.

 

Whether we are the former or the latter is left as an exercise for the reader...

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 8
(2,955 Views)

Law of averages says that the more people in the group that posted the same thing, the more likely they are to be mediocre.  (Since great minds are rare)

 

Damn.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 7 of 8
(2,944 Views)

Law of averages says 

 

Crap, now I have to go get my lawyer involved? 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 8
(2,939 Views)