LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How should I store constants for use between labview sessions?


@ijustlovemath wrote:

I was thinking about that! Can I use property nodes to set default values?


There is a property node to do that but it only works while in EDIT Mode.  I've tried to use it to save defaults on program exit but the property node errors out since the VI is in RUN Mode at that point.  I don't know what that property node is intended for.  Smiley Frustrated

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 11 of 26
(1,556 Views)

NI, why must you tease us with such features!

0 Kudos
Message 12 of 26
(1,553 Views)

@NIquist wrote:

@ijustlovemath wrote:

I was thinking about that! Can I use property nodes to set default values?


There is a property node to do that but it only works while in EDIT Mode.  I've tried to use it to save defaults on program exit but the property node errors out since the VI is in RUN Mode at that point.  I don't know what that property node is intended for.  Smiley Frustrated


One word: Scripting


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 26
(1,535 Views)

What is stopping you from creating your own INI file with some default starting parameters or even downloading it from somewhere?

0 Kudos
Message 14 of 26
(1,525 Views)

Nothing, I just thought it was a sort of messy way to handle it. I figured there was a better way that I didn't know about.

0 Kudos
Message 15 of 26
(1,520 Views)

That is what I would do. Then if your parameters change, write that back to the INI file and you're in business for the next time that system runs again.

0 Kudos
Message 16 of 26
(1,508 Views)

@crossrulz wrote:

@NIquist wrote:

@ijustlovemath wrote:

I was thinking about that! Can I use property nodes to set default values?


There is a property node to do that but it only works while in EDIT Mode.  I've tried to use it to save defaults on program exit but the property node errors out since the VI is in RUN Mode at that point.  I don't know what that property node is intended for.  Smiley Frustrated


One word: Scripting


Again, ONLY AVAILABLE IN EDIT MODE. 😉

 

Applications generally do not modify themselves. Changing the default value of controls or constants inside a running application would require modifying the executable, which then causes all sorts of problems.

0 Kudos
Message 17 of 26
(1,495 Views)

That makes sense. I was wondering how it might work should I compile it as an EXE.

0 Kudos
Message 18 of 26
(1,477 Views)

For an EXE you're pretty much going to need to write to an external file on program exit and read it back on initialization.  The config VIs in the File palette create nice keyed text files that can be read and modified by any text editor.  XML files can also be used and there are registry tools in the Connectivity palette where you could write configuration data.  These are all pretty standard methods used by a lot of software today.  Another advantage of config files is that you can keep multiple configuratons and change your program defaults by simply reading in a new file.  Of course you have to program that functionality in yourself.  Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 19 of 26
(1,440 Views)

Does the fact that LabVIEW stores its 'configuration" data (such things as the list of Projects and VIs shown in the Getting Started with LabVIEW opening screen) in a Configuration file (specifically, in LabVIEW.ini) should tell you something.  Also, NI provides (in the File palette) a series of VIs for manipulating Configuration files.  However, if another file type (Excel, .xml, text) suits your fancy, why not?  It's just that there is already some "logic" built into the Configuration VIs ...

 

Bob Schor

0 Kudos
Message 20 of 26
(1,410 Views)