Example Code

Saving and Loading Control Values to and from a File in LabVIEW

Code and Documents

Attachment

Overview:

This VI will save all your VI's control values to a file by converting them to an XML string.
Description:
The VI will also load these values into the VI's controls.
Requirements:

  1. LabVIEW 2012 (or compatible)

Steps to Implement or Execute Code:

  1. Run the VI.

Additional Information or References:

read_load_controls.png

"**This document has been updated to meet the current required format for the NI Code Exchange.**"

National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
WG-
Member
Member
on

Very nice. Didn't know this was possible, this code will surely help me with a project I have.

pritam15
Member
Member
on

really thank you

WG-
Member
Member
on

I just tested the VI but I notice that it doesn't work ;( It goes bad when the loaded xml string needs to be flattend by the "xml flatten vi" it says

     Error 1106 occured at Unflatten From XML in Save or Read Control Values To and From a file.vi

     Possible reason(s): LabVIEW: The XML tag describing the type of data does not match the wired type.

You know a solution?

A_Patel
NI Employee (retired)
on

Looks like there is a bug in LabVIEW 2009 that does not allow Variants to faletten to XML. I modified the code to make it work. Try the new download. Not as clean, but does the trick.

National Instruments
Applications Engineer
WG-
Member
Member
on

Pity... because the xml was pretty readable now it isn't anymore because you don't know what value the data represents.

mmiers
Member
Member
on

Good Idea but I had to change the scheme slightly to get it to work in 8.6.1.

http://decibel.ni.com/content/docs/DOC-13949

smallmediumlarge
Member
Member
on

Late to the party, but this helps a lot, thanks!