LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to use one property node and changing the variable its associated to

I am running a VI that has many controls and can be set up to run different experiments requiring different settings. I have built a load and save function which gives you the ability to save and load up parameters in to each variable using the key vi's. The problem is that each individual control needs its own read key and value property node and I have hundreds of controls and I wondered if there was some way you could have a generic property node and feed in the variable where value should be sent you could then just have a for loop aith two arrays one holding the variables name and the other containing the values this would occupy a very small physical space on the diagram.
0 Kudos
Message 1 of 6
(3,071 Views)
Hi Mr_Nice,
 
See if the method in the picture helps or not.
I usually do this if I have a set of varialbles of the same type and can be changed properties using a loop.
 
To get the Reference, right click on the icon just like the way you create a Local Variable, and then choose Create->Reference.
 
Hope it helps...
 
Message 2 of 6
(3,065 Views)

Cheers Deepu

That is defo the best I have but what would be even nicer for me if I could have a string array where the string somehow references the variable. I could then generate a text file with all the variable names and values. As a stop gap I may see if I can build an array of references

nice

Message 3 of 6
(3,058 Views)
Hi mr_nice, take a look at the attached example. The code is somewhat time expensive, so it's not suitable for a high number of controls and a frequent change in the control list.
The best usage is at program initialisation. Hope this helps.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Download All
Message 4 of 6
(3,049 Views)

Dennis

Thats brilliant I have included an extension to the vi (I am still using the sub vi you created)to read in a file and seperate the control data and have done it for more than just booleans. May be useful to others (it may not of course)

Only one question has arisen from this, the value property node has to be run inside the case structure as when you try to take a line out of a case structure the little block on the wall of the structure takes a particular data type (i.e. string) and will not take mulitple data types I would really like to have the property node outside the structure as I can then make the whole thing in to a sub vi and have the node outside in the main vi.

Anyone know how I can do this

 

nice

Download All
0 Kudos
Message 5 of 6
(3,033 Views)
You can do this using the variant data type, check the attached vi.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 6
(3,030 Views)