LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Importing configuration data from a .sav file.

Solved!
Go to solution

At what point would the changed values be inserted into the vi? When the binary file gets opened it configures the program with the bad values. How would I go about writing in the new values? 

 

Sorry, I'm really new to this.

0 Kudos
Message 21 of 31
(1,571 Views)

You have the code to read the file. Once you've read the file you have the existing data. The Write to Binary File is right next to the Read from Binary File in the palette. 

 

Also, if you're new to LabVIEW then it would be beneficial to check out the training materials at the top of this forum. Also, NI is offering their online training courses free until the end of April. If you're charged with maintaining/developing LabVIEW code then the time spent in training will save you considerably more time in the long run.

0 Kudos
Message 22 of 31
(1,571 Views)

@JayWW wrote:

At what point would the changed values be inserted into the vi? When the binary file gets opened it configures the program with the bad values. How would I go about writing in the new values? 

 

Sorry, I'm really new to this.


You need to write a new program. Copy the read code from the old program. As BertMcMahan said you take the output from that Read from Binary File, modify the necessary values in it, and then write it back to file.

0 Kudos
Message 23 of 31
(1,569 Views)

I think it's coming in as a single cluster, so you can use "Bundle By Name" on the wire going out. If it's an array you will need to choose which element, so use "Index Array".

 

Try this: first, make a copy of everything, because you risk overwriting your previous settings file.

 

Make a copy of the code you showed us, and remove everything except "Open file", "Read binary file", "Close file", and the cluster coming in to "Read". Right click on the output from Read file and select Create Indicator. Run the file, and see what that indicator says. It will give you the contents of the file. Show us a picture of that.

 

Probably the simplest way to do this would be to run the code I mentioned, then delete the wire between Read and the indicator, then right click the indicator and select "Change to Control" (so you can edit it), then wire THAT indicator into a Write to File function, then run the code again.

0 Kudos
Message 24 of 31
(1,565 Views)

@johntrich1971 wrote:

@JayWW wrote:

At what point would the changed values be inserted into the vi? When the binary file gets opened it configures the program with the bad values. How would I go about writing in the new values? 

 

Sorry, I'm really new to this.


You need to write a new program. Copy the read code from the old program. As BertMcMahan said you take the output from that Read from Binary File, modify the necessary values in it, and then write it back to file.


It might not even be necessary to do that.  There should be VI in there to write the file in the first place (I am making an assumption here that it was at least somewhat modularly written).  Just find that VI, update the front panel controls, point it to the file path you want to write, and run the VI.  No coding or reading of the file necessary.


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
Message 25 of 31
(1,563 Views)
@BertMcMahan wrote:

I think it's coming in as a single cluster, so you can use "Bundle By Name" on the wire going out. If it's an array you will need to choose which element, so use "Index Array".

 

Try this: first, make a copy of everything, because you risk overwriting your previous settings file.

 

Make a copy of the code you showed us, and remove everything except "Open file", "Read binary file", "Close file", and the cluster coming in to "Read". Right click on the output from Read file and select Create Indicator. Run the file, and see what that indicator says. It will give you the contents of the file. Show us a picture of that.

 

Probably the simplest way to do this would be to run the code I mentioned, then delete the wire between Read and the indicator, then right click the indicator and select "Change to Control" (so you can edit it), then wire THAT indicator into a Write to File function, then run the code again.


 

 

Here's what the indicator outputted when looking at the output of the read binary file.

JayWW_0-1585594108651.png


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

OK, buncha stuff there- I'd suggest doing what I said in my last post. Right click, convert to Control, wire to Write to File. Change the values on your screen then run the program.

0 Kudos
Message 27 of 31
(1,541 Views)

@BertMcMahan wrote:

OK, buncha stuff there- I'd suggest doing what I said in my last post. Right click, convert to Control, wire to Write to File. Change the values on your screen then run the program.


How do I specify the output file path out of the "Output Digital File"?

0 Kudos
Message 28 of 31
(1,539 Views)
Solution
Accepted by topic author JayWW

You don't want "output digital file" you want "Write to Binary File". Mimic the same functions you used to Read the file, just swap the Read for a Write. Path is specified in the Open function. Right click on the terminal and select "Create constant" then you can edit the constant.

 

BertMcMahan_0-1585596719396.png

 

Message 29 of 31
(1,530 Views)

@BertMcMahan wrote:

You don't want "output digital file" you want "Write to Binary File". Mimic the same functions you used to Read the file, just swap the Read for a Write. Path is specified in the Open function. Right click on the terminal and select "Create constant" then you can edit the constant.

 

BertMcMahan_0-1585596719396.png

 


That worked! I saved the outputted file and replaced the old settings file with it and the new power supplies came alive! Thanks! There's no way I would have figured that out on my own. Still working on Core 1 of the Labview training. 😀

0 Kudos
Message 30 of 31
(1,520 Views)