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: 

How do I write data to a file without prompting the user for a file location?

Greetings,

 

I am new to labView and do not have very much experience.  I am trying to write a VI that collects data and writes it to a file.  I run the VI and get a window that asks where I would like to save the file and what to name it.  After specifying a name and location and allowing the VI to complete I open the file that I just wrote.  The problem is that there is a jump in the data, it will give the data collect on the first iteration of the VI but then there will be a jump in time and data. The jump, I am assuming, is because the VI will not collect data until after I have specified the name and location of the file I am writing to.  How can I set up the VI so that there is no jump in data collection?  I have attached a file with some sample data that I collected.  The 'jump' is circled in red.

 

Thanks in advance!

0 Kudos
Message 1 of 8
(2,938 Views)

Try this.  By naming the file before hand using a file path control (or a constant on the block diagram), it will write to the file without prompting.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 2 of 8
(2,930 Views)

What are you doing with the data once you've collected it?  Pulling it into Excel?

C

0 Kudos
Message 3 of 8
(2,913 Views)

I am storing it on a USB drive so that I can access it on other programs such as matlab.

0 Kudos
Message 4 of 8
(2,906 Views)

Looks like your data is just a tab delimited text file?  Are you just manually starting and stopping the daq process or are you dialing into a set of parameters and taking a specified number of points or what?

0 Kudos
Message 5 of 8
(2,892 Views)

Yes, my data is a tab delimited text file.  The VI is set up to collect a specified number of points and then stop running.

0 Kudos
Message 6 of 8
(2,870 Views)

Have you tried what I recommended?  Are you still having issues or is the problem resolved?  If not, post your VI.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 7 of 8
(2,857 Views)

Thank you all for you comments and suggestions.  I believe I have discovered the problem.  I had originally had the write to measurement VI inside of a loop that did not stop until a button was pressed.  Doing things that way LabVIEW needed to decide when to write the data to a file and it chose to do it after the first x number of samples, which was specified.  The was I have it now is that there is not an 'infinite' loop and the program stops after a set number of samples is recorded.  This way LabVIEW records all the data and then asks me where I want it write the data.

 

Thanks again for all the input!

0 Kudos
Message 8 of 8
(2,828 Views)