From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting a file to save data while vi is running

Hi, I have created this vi to read my data using DAQ-6008 and saving in a text file. I am using a on/off switch to select when to write the data in text file. However, i wish to manually select a different text file and start writing the data while the vi is still running. With the present vi, i must choose a file at the starting of the process. I can choose a different file while the vi is running, but it does not write any data in that file. Can anyone suggest how to do it. I am new to LabVIEW, and all these i have done using the tutorials. So any help is appreciated. 

0 Kudos
Message 1 of 6
(1,564 Views)

A Producer/Consumer is what you should probably be using here.

 

The Producer Loop would initialize the DAQ and continuously acquire data.

 

The Consumer Loop would be an Event Driven State Machine that would:

  1. Display the data
  2. When Save data is pressed
    1. Open a new data file
    2. Save data to the file 
    3. Close the file when done

 

========================
=== Engineer Ambiguously ===
========================
Message 2 of 6
(1,523 Views)

Just use the Write to File Express.vi

 

That might start a flame war🔥 but, those Express VIs are easily configured by novice users who just want to "Get-r-Done".  

 

There are more elegant solutions. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 6
(1,498 Views)

Can you "save for previous", e.g. LabVIEW 2020. (I cannot see what you are doing, but it sounds like you are violating some dataflow principles).

 

What are your requirements? For example is it OK if no data acquisition takes place while the file dialog (where you select the new file) is open? What should happen in the user cancels the file dialog? Etc.

 

Please write down a full list of requirements and behaviors so we can suggest the best solution.

Message 4 of 6
(1,492 Views)

@altenbach wrote:

I cannot see what you are doing, but it sounds like you are violating some dataflow principles.


Their program architecture is One Big Loop... IMHO: That's the real issue here.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 6
(1,489 Views)

@RTSLVU wrote:
Their program architecture is One Big Loop... IMHO: That's the real issue here.

I guess the file dialog is before the loop? 😄

0 Kudos
Message 6 of 6
(1,486 Views)