From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

presetting a Control

Hi

Is it possible to set a numeric Control to a specified value.
I know, I can preset it to one specific value. But I need to set the
value dynamicaly.

To explain: I want to read some values from a file to an Array. I want
to modify that Array und when pushing a button the values are saved back
to the file.

The only problem is how to preset the readed values to the control for
modifieying it. Can anyone help me please. Thank you.

Bye
Martin Senft
0 Kudos
Message 1 of 2
(2,875 Views)
Martin, you have to use a local variable. A local variable is essentially
like a copy of a front panel control or indicator. It allows writing to a
control and reading from an indicator. You can insert the local varible
which represents a control (or ind.) by right clicking with the mouse on the

control's terminal on the block diagram (BD) and then select 'Create local
variable'. (The control must have a label for this to work!). There can be
as many locals as you want on the BD.

Use locals with care, however. They increase the memory size, because for a
control with associated locals there is always an extra copy of the data
kept in memory. In your case this doesn't matter, AFAIK, since it is a
dialog VI with front panel open. Open panel VIs always have extra
copies in
memory anyway. I think there is something said about this topic in the
manuals somewhere..... 😉

Of course race conditions (what is wrote/read first, the locals or the
control/ind. itself?) have to be considered also. With the locals you spoil
the dataflow concept.

Take care...


Franz

Martin Senft schrieb:

> Hi
>
> Is it possible to set a numeric Control to a specified value.
> I know, I can preset it to one specific value. But I need to set the
> value dynamicaly.
>
> To explain: I want to read some values from a file to an Array. I want
> to modify that Array und when pushing a button the values are saved back
> to the file.
>
> The only problem is how to preset the readed values to the control for
> modifieying it. Can anyone help me please. Thank you.
>
> Bye
> Martin Senft
>
0 Kudos
Message 2 of 2
(2,875 Views)