LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cluster or array or other solution

Hi


I have an labView6i program roughly consisting of 3 components :

'main program' : calls the 'read subvi' every program cycle, and displays
the the output.
'read subvi' : read a number of ADC channels, convert the ADC voltages to
physical values, and return them as an cluster/array.
'save subvi' : save current readback values and names of ADC channel to a
file.

Every physical measurable quantity has a name, conversion formula, and an
ADC channel. So I want all these informations in the 'read subvi' (as an
constant) and only once (so it is easy to change).
The 'save subvi' needs the names from the 'read subvi' so I have changes
the 'read subvi' to output both values and names(two different
clusters/arrays).

1:
If I output the va
lues from the 'read subvi' as an named cluster, they are
farely easy to distribute to difrent instruments(placed in different tabs)
in the 'main program' using 'unbundle by name'. But in that way every
channel has two names... the label in the cluster, and the string conctant
used e.g. by the 'save subvi' .

2:
If I output the values an an array there i a big risk that an instrument in
the 'main program' vill show the wrong channel (if you change the order in
the 'read subvi' and forget to do the same thing in the 'main program').

Is it posible to convert an string constant to an label/name(later to be
used to 'unbundle by name') on runtime ? or is there an other brilliant
solution to my problem?



/ Peter
0 Kudos
Message 1 of 2
(2,549 Views)
Why not define the cluster array in your main VI and pass it (as an array or as individual clusters) to the read and save sub-VI's? The sub-VI's will then be more general purpose: they'll read and save whatever you tell them to.
You can use Property Nodes to read the names (label text) of controls in a cluster. But you can't use Property Nodes to change the control names: you'll get an error like "Error 1073 occurred at Property Node (arg 1) in Read Cluster Control Names.vi. Possible reasons: LabVIEW: This property is writable or this method is available only when the VI is in edit mode."
You need to select the item for Unbundle by name while editing the VI, not at run-time.
If the main VI defines the cluster, why do you need to read the control labels at r
un-time? Why not just use a string control in your cluster instead of constants and labels?
Here's an example of reading and trying to write label text for controls in a cluster. I really don't think you need to do anything like this, but I don't really understand your application.
0 Kudos
Message 2 of 2
(2,549 Views)