02-17-2015 07:17 AM
Hi all
I have been thinking about a nice way to do automatic adjustments on a random number of datatypes in a 1D array:
So I have a for loop that takes lets say a 1D array of waveforms as input. I want to be able to adjust gain, offset and to enable/disable the waveforms individually, with respective controls on the front panel.
The name of each control should take after the name of the waveform, with the functionallity extension eg. gain, offset and enable.
So if the waveforms are called Data1 to Data10, then the code should generate controls called "Data1 offset" , "Data1 gain", "Data1 enable" ... all the way through to Data10...
Each control should be placed in a control pane on the front panel, and by using of some property node they are arranged in a nice way (at least this is my current thought).
I hope it makes sense what I am trying to do, and that some of you are able to give me an idea of how to start! I have tried to sketch it in the following snippet..
Best,
Tommy
Solved! Go to Solution.
02-17-2015 02:37 PM
Hi Tommy,
One idea would be to make an array out of a cluster of controls, then use a property node to show as many controls as you have waveforms.
Chris
02-17-2015 03:34 PM
One idea would be to make an array out of a cluster of controls, then use a property node to show as many controls as you have waveforms.
Chris
While an Array of Clusters is a good idea, I'm not sure how you'd get unique Names (like Chan 1, Chan 2, etc.). But the Clusters makes sense. Create a cluster with Gain, Offset, and Enable, and make a TypeDef out of it. Now put this down on your Front Panel whereever you want Channel 1 to be. Label the cluster Channel 1 -- LabVIEW's natural "grouping" of the Cluster "control" will do the rest, and more cleanly (in my opinion) than having a Channel 1 Gain, Channel 1 Offset, Channel 1 Enable. Of course, this only works if you can group the controls in a nice manner (note that LabVIEW lets you easily arrange Cluster elements horizontally or vertically, and once they are aligned, you can turn off alignment and "adjust" the positioning). Best of all, if you tweak the TypeDef, then any "Channel Control" you put on your Front Panel will have the same look.
Bob Schor
02-18-2015 02:16 AM
Hi,
I agree that a TypeDef'ed cluster is the way to go.
Do you have a fixed number of channels? If so, you can pput multiple clusters on your front panel and give each cluster a unique name:
However, if you want a variable number of channels, then you need to use an array like what qzerror suggested.
Bob_Schor wrote:Best of all, if you tweak the TypeDef, then any "Channel Control" you put on your Front Panel will have the same look.
Use a Strict Type Definition if you need to update multiple clusters.
02-19-2015 12:53 AM
Hi all
First of all, thank you for the ideas!
However, I cant figure out how to give each cluster a unique name. I've tried to make it both a strict and normal type def but every time I (manually) change the name of one cluster in the array, all others change name as well.
I also tried with a property node both with name and caption but neither works in run time. The attached is as far as i got. I also thought about adding a string to the typedef and just edit the string according to the package name, however this does not look as nice in my opinion and I consider this solution a "last resort".
Thanks,
Tommy
02-19-2015 02:32 AM
Unique names can only be given to individual clusters added to the front panel, as each cluster has its own label.
Array elements cannot have unique names, unfortunately. The array gets a label, but its elements don't.
The extra-string-in-typedef sounds like the easiest way to do what you want in an array (but I agree it's hacky)
02-19-2015 02:35 AM
Okay.
I'll give it a shot, maybe I can format the string box with the same color as the background in the cluster and get it to look like it only is a text and not a box.
I appreciate the help!
Best,
Tommy
02-19-2015 02:38 AM
02-23-2015 12:32 AM
Hi All
Thanks for your ideas. I think it got it the way I want now. GerdW it was a nice idea with the transparent string indicator, it looks just like a normal text 🙂
Good day to ya' all!
Best,
Tommy
02-23-2015 09:51 AM
Very clever! I must confess I never thought of doing this!
Bob Schor