LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Without manual entry can you input a value into a numberic control?

I am using a numeric control and a button (with a case structure) to manually input numbers into a function.  However, I also want to be able to, via a text file, enter numbers into that same numeric controller, so that I can again hit the button and have the number enter the function.
0 Kudos
Message 1 of 8
(3,067 Views)
To set the value of a control programmatically use a local variable of that control, or use a property node and select the "Value" property. To use a local variable, right click on the control and select Create->Local Variable. This places a local variable object on your block diagram. Just wire a value to it. Same kind of deal with the property node.

You should peruse the LabVIEW documentation and the tutorials to learn more about local variables and property nodes.
Message 2 of 8
(3,059 Views)
I think I would do this using a property node instead of a local variable.  Go to the block diagram and right-click on the control.  From the shortcut menu select "Create-->Property Node-->Value".  Right-click the property node that you just created and select "Change all to write".  Now wire the new value to the property node.  This will change the value set in the control.
Message 3 of 8
(3,049 Views)
I have always been using local variable to do this kind of work. Can you explain the advantages and disadvantages of the two ways?
 
Best regards,
 
Guangde
0 Kudos
Message 4 of 8
(3,041 Views)
In this case, I think they are doing essentially the same thing.  However, from what I understand (which may be wrong), the local variable is being stored in memory and is always updating.  Writing to the local variable will set the value at that time, but it's still updating the value of the local variable all the time.  With the property node, nothing additional is being stored in memory, so there is nothing to update.  It just sets the value of the control when it is executed.  Local variables are very useful and probably have much more functionality that a property node would.  But in this case, I think the simplest answer is the property node.
Message 5 of 8
(3,034 Views)
The other big difference is that because local variables only have the data value input it can be hard getting them to update exactly when you want them to. By contrast a property node has error cluster input and output so you can easily specify exactly when it updates.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 8
(3,022 Views)

endmile said:
Writing to the local variable will set the value at that time,
but it's still updating the value of the local variable all the time.


What exactly do you mean by this?



endmile said:
But in this case, I think the simplest answer is the property node.


That's not a valid conclusion. There is no "simplest" answer. It's all context-based. There's nothing "bad" or "evil" about local variables. In fact, they tend to be faster than writing to the "Value" property node. Let's just say that proper use depends on understanding how each operates, and once you know that, each can be used effectively.

I hope this doesn't become another one of those "local variables vs property nodes".

0 Kudos
Message 7 of 8
(3,002 Views)
It wasn't meant to be like that at all.  Local variables are very useful.  By simplest answer, what I meant is the one that I found to be simplest in terms of memory usage, ease of implementation, and understanding.  I am not an expert user and I don't claim to be.  I was just trying to help by giving the method I thought would be easiest to implement for the person who asked the question.
0 Kudos
Message 8 of 8
(2,994 Views)