LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save/restore all numeric controls values to/from file

Hi Smercurio,

I followed many LV training courses, also expensive courses held by NI. Unfortunately, sometimes I remember that a function is implemented, but I forgot how to make it work.

So I search the NI forum for an already existing solution.

When I found it, I try to use it, and if I get an error I'm not supposed to, I ask for advice.

I apologize if I violated the forum methodology

0 Kudos
Message 11 of 20
(1,941 Views)

You do not need to apologize. I meant no disrespect from my comment. It's often we get people with no LabVIEW experience asking very basic questions which can be answered by either going through the tutorials or simply opening the Help file. YIn other words, while A may imply B, B does not always imply A, and in this case I assumed it did. I'm sorry about that.

 

As for your issue: I do not get an error when the paths are the same. Even if the paths are not the same, then the write should work, and it does. I do notice, however, that the error messages you posted have a name of the VI that's different than the VI posted in this thread. Are you actually using the same VI, or a modified version of it?

0 Kudos
Message 12 of 20
(1,931 Views)

again...

 

 

Could you please take a look at your path.

In my exmaple it's

"C:\Daten" or "C:\hallo"

 

Then open your Windows Explorer and look at "C:\" is there file / folder names "Daten" or "hallo"??

If so, please delete this file/folder!!!

 

Or your go into your blockdiagramm and change "open or create" -> "replace or create"

 

Does this help???

0 Kudos
Message 13 of 20
(1,924 Views)

According to one of my previous posts, I created a very simple VI with only two controls on the front panel, and named it "fake.vi". Of course, I selected it from the path dialog on the front panel.

I Tried both Dippi's solutions, but none is working.

 

Few more details: now the name of the file is "daten" both for read & write.

If I try to read, I get no errors, but nothing happens as well (no surprise, since writing doesn't work)

If I try to write, the errors are generated by the "close file" and "close reference" VIs (the ones executed at the end of the loop).

 

Anyway, thanks for your suggestions

Message Edited by xdaf on 11-04-2009 05:14 PM
Message Edited by xdaf on 11-04-2009 05:18 PM
0 Kudos
Message 14 of 20
(1,913 Views)

Do you have write privileges to the C:\ folder?

 

I still think you are using a different VI. Your error dialogs clearly indicate a different VI name, and also reference a different file. In fact, error1.jpg is showing that it's accessing c:\hallo.ini.  That filename isn't anywhere in the VI that was posted on this thread.

 

Please post the VI that you are actually using.

0 Kudos
Message 15 of 20
(1,891 Views)

Here they are.

I am administrator of my PC, with full R/W access.

One more detail: when I launch the VI in "lese" mode, some chars are written in the "daten.txt" file. In "setze" mode, the file is completely emptied. I added the .txt extension in order to quickly open it via notepad.

Thanks for your time, really appreciated

Message Edited by xdaf on 11-04-2009 06:55 PM
Download All
0 Kudos
Message 16 of 20
(1,882 Views)
I was right. It's not the same VI. It has been modified. Specifically, the "operation" has been changed from "open or create" to "replace or create" for both reading and writing. This is obviously incorrect. You do not want to "replace or create" the file when reading. This will clearly overwrite what you just wrote when saving the control values. You want to "open" it, so the "operation" should be set to "open" ("open or create" will also work, but the "create" is really pointless in this case).
Message 17 of 20
(1,869 Views)

When you want to read from the file, you need to open it...not "replace or create" it.  Try changing your file operation to "open" in your "read" case.

 

You can "replace or create" when you want to write to the file.

Message 18 of 20
(1,866 Views)
You're right, it's working now. Thanks a lot!
0 Kudos
Message 19 of 20
(1,835 Views)

It should also be pointed out that the name of the VI is misleading. The file that's saved is not an .ini file - it's a binary file. Completely different. If you are intending to use .ini files then you need to use the configuration VI.

 

I would suggest you look at the OpenG VIs. There's a set of VIs that read/write config files, including one that reads/writes the front panel to a .ini file.

0 Kudos
Message 20 of 20
(1,824 Views)