LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a Vi retain the value of its last execution?

When I close a VI, I would like it retain its present value automatically such that I have them when I open it the next time. (It seems that they alway return to their default values when I open it and I don't want manually set them to default before I quit the VI). Thanks in advance.
0 Kudos
Message 1 of 6
(3,583 Views)
Probably this is what you are looking for:

Programmatically Saving a VI's Default Values using VI Server and Rendezvous
[http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/ca66f25b8da1fbed86256854007067d2?OpenDocument]

How Can I Save Default Values in the Executable Version of a VI?
[http://digital.ni.com/Public.nsf/websearch/bcff7d3335e256e2862565090067723d?OpenDocument]

Good Luck!
Message 2 of 6
(3,583 Views)
Thank you for your answer. I thought Labview had a clean way to do it, i.e., an option hanging somewhere that a user can, for instance, choose from the pop-up window of VI setup.
0 Kudos
Message 3 of 6
(3,583 Views)
Onion wrote:
>
> When I close a VI, I would like it retain its present value
> automatically such that I have them when I open it the next time. (It
> seems that they alway return to their default values when I open it
> and I don't want manually set them to default before I quit the VI).
> Thanks in advance.

I have an example on my web site that works in a way very similar to
the NI example previously suggested to you. One main difference is that
mine is designed as a sub-vi that can be quickly added to any existing
VI, whereas the NI example show you how to do it but requires that you
copy the relevant code into you VI. In any case, the results and the
mechanisms are virtually the same, but you are welcome to try mine out.
Go to www.originalcod
e.com, then select Example Code, Utilities, and
Program Downloads, then look for Save Front Panel Control Defaults.

Regards,
Dave

-------------------------------------------------------------
David Thomson 303-499-1973 (voice and fax)
Original Code Consulting dthomson@originalcode.com
www.originalcode.com
National Instruments Alliance Program Member
-------------------------------------------------------------
Research Scientist 303-497-3470 (voice)
NOAA Aeronomy Laboratory 303-497-5373 (fax)
Boulder, Colorado dthomson@al.noaa.gov
-------------------------------------------------------------
Message 4 of 6
(3,583 Views)
Onion wrote:

> When I close a VI, I would like it retain its present value
> automatically such that I have them when I open it the next time. (It
> seems that they alway return to their default values when I open it
> and I don't want manually set them to default before I quit the VI).
> Thanks in advance.

Hi Onion,
for this job, I allways use a shift register in the calling VI, and let
the called VI pass back its results to this shift register. On the next
call of the same vi, I take the data of the last VI- call from the shift
register. This works much faster, than using global variables for instance
and is pretty easy to programm.

Ciao,
Rainer
0 Kudos
Message 5 of 6
(3,583 Views)
Onion,

Are you looking to save outputs? Inputs? Both? For what reason?

If I read between the lines correctly, you seem to have a tool VI that you once in a while change the inputs according to various factors. If you want to retain the values you set, and don't want to 'go through the hassle' of selecting Operate>>Make Current Values Default from the Menu and Saving the VI, then you can do this programmatically through VI server.

I will not bother to explain how to do this from VI Server because I suspect that you will find it much easier to discipline yourself to do this manually until you decide you want to make a utility to do it. At which time, you can refer to the aforementioned examples for the details of such coding.

I hope this helps.


Good luck
0 Kudos
Message 6 of 6
(3,583 Views)