08-11-2014 01:15 AM
Hi everyone. This is my first post on the forum. Please excuse me if my question seems incomplete.
Coming to my question, I am using Labview 2012. What I want to do is to read a data from a text file and save the path of this text file for every successive run of the vi. I am using the read from text file vi. In the first occurence, I give the user a prompt to find the file he wants to read,but from the next occurence I want the user to be able to continue without being asked for the file path unless he wishes to change the file.
08-11-2014 01:36 AM
08-11-2014 01:44 AM
Hi GerdW,
Thanks for your reply. But my problem is that the first time I have to ask the user to choose a file from the dialog. How do I wire separate inputs to the read from text file vi? I need a blank input(i.e. open a dialog box) on the first occurence and to remember this path and wire to the same input on further occasions.
08-11-2014 01:47 AM
Hi Apoorv42,
you need some progam logic involved:
load(filepath from INI file) IF filepath == "empty path" THEN filepath = FileDialog() ENDIF LoadFile(filepath)
Do you think you can create a simple case structure like described by this pseudocode?
08-11-2014 01:57 AM
Hi GerdW,
I was also thinking on similar lines but the problem is how to compare the input of read from file vi with an empty path. I am attaching a VI for your reference in which I am trying to implement a case structure as per the code. The front panel is empty. Please find the case structure in the block diagram.
08-11-2014 02:06 AM
08-11-2014 06:23 AM
That VI is just storing the reference to a file. As soon as it goes out of memory, that reference is gone. Besides, you really need to be closing your references.
There are several functions available to see if the path given is empty (Empty Path? is found in the comparison palette) or if the file even exists (look in the File->Advanced palette).