LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the "Make Current Values Default" as a control on the front panel

Solved!
Go to solution

For something like that you can either use LabVIEW to save the binary data which can be read back correctly, use "flatten to string" to save the data, or device your own format (such as a CSV file) if you need to allow the data to be viewed or modified outside of LabVIEW.

 

The correct answer will really depend on what you want/need to do with it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 23
(2,190 Views)

Here is an example of how I do this. I use flatten to xml but as Mark points out you can flatten to string instead.

 

It is more convenient if you can create a typedef cluster containing the controls you want to set the default for.

 

 

=====================
LabVIEW 2012


Message 12 of 23
(2,173 Views)

Hi Steve

 

thanks a lot for your answer! but I want to create multiple clusters of the same element type. 1 universal save button could save all the values in the cluster.

 

How do I get around this? I tried to create the correct VI but seem to be stuck.

 

Thanks again for your answer!

 

mhaque

0 Kudos
Message 13 of 23
(2,157 Views)

You might consider using a separate file for each cluster.

 

=====================
LabVIEW 2012


0 Kudos
Message 14 of 23
(2,146 Views)

 


@SteveChandler wrote:

You might consider using a separate file for each cluster.

 


 

Or store them as an array of clusters. Though this would require creating the array on the fly when the user saves the data. The typedef was not included in the last posted code so when I opened it it was broken but are you using a separate control for each tab? One way to use an array internally but display the correct value on the tab would be to use a single control representing one set of data. This control is configured to be common for all the tabs. Internally in a shift register you have an array of the controls. This can easily be intialized from the file since the entire array would be read from the file. Same holds tru for writing in. On the UI when you switch the tab you simply set the the value for the display control to the corresponding position of the array data.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 15 of 23
(2,138 Views)

Doesn't work if I want to unbundle the array into its separate elements. Only steps and Stop Timer shows but the matrix is nowhere to be seen?

 

Thanks for all your help!

 

mhaque

0 Kudos
Message 16 of 23
(2,127 Views)
Solution
Accepted by topic author mhaque

I made the vi just save all the controls on the front panel. It will work if you remove some or add some.

 

I had to remove the tab control and use an array. The controls in the tabs were not being saved. I think this is because I am getting the Controls[] property  for the front panel and it didn't include controls that were placed on the tab panel.

=====================
LabVIEW 2012


Message 17 of 23
(2,121 Views)

wow amazing, but could I label the indexes of each array as A1, A2, A3... rather than 1, 2, 3 wihtout making the code too complicated?

 

Thanks a million!

 

mhaque

0 Kudos
Message 18 of 23
(2,118 Views)

No problem. One thing you can do is to hide the index and select the index from an enum.

=====================
LabVIEW 2012


Message 19 of 23
(2,110 Views)

Here is an example of what I was suggesting earlier. This example uses a Tab control like your original post but saves the data as an array. You can initialize the array from the file when you start the application as well.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 20 of 23
(2,104 Views)