LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

auto run vi after loading path file

I was wondering if there is a way to automatically run a VI after you click on "OK" to load a file from the file path control as opposed to selecting file and then manually clicking run each time on the front panel toolbar.  I attached the simplified VI and txt file to be plotted for clarity.

Download All
0 Kudos
Message 1 of 5
(2,997 Views)

Well, you cannot do exactly what you asked, but you can make it work the same way for the end user.

 

Set the VI to run when opened.  Put everything inside an event case which is set to monitor the value changed event for the Path control.

 

If you want to be able to read more than one file each time you run the program, you need to put the event case inside a while loop.  Create a Stop button on the front panel and add an event case for the Stop Value changed event to stop the loop.

 

Lynn

0 Kudos
Message 2 of 5
(2,989 Views)

So I tried what you suggested and I believe it's working like you said it would.  For situations where you would select multiple files, I put the event structure inside the while loop.  One thing I noticed is if you select a file and the VI runs and then select the same file again...a error pops up in the "Read from Measurement File" object.  Is there a way to ignore this error?  It works fine if you select a different file otherwise.

0 Kudos
Message 3 of 5
(2,978 Views)

 

  • What kind of errors do you get when reselecting the same file. Do you have an error number? (I cannot test, because I don't have your data file).
  • To ignore the error you could place everything after the file reading into a case structure and wire the error out to the case selector.
  • You also need an event for the stop button.
0 Kudos
Message 4 of 5
(2,976 Views)

It generates error 4, EOF encountered.  The Express Read from Measurement File VI apparently remembers the last file read and attempts to read more data from that file.  A True connected to the Reset input will make it read the file from the beginning.

 

Read the help.

 

Add an event case for Stop as both altenbach and I recommended.

 

Lynn

0 Kudos
Message 5 of 5
(2,964 Views)