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 to Write Waveform graph data to Text File with user option to do so

Solved!
Go to solution

So, I'm new to labview and am having trouble writing one program in particular.  I have a waveform graph that runs for 120 seconds generating a sine curve.  I am, however, having a difficult time getting the program to write the x and y coordinates into a text file.  I have attached what I have so far.  

The first task I was assigned was to write a program that creates a snusoidal curve on the front pannel adding one data point each half second for 120 seconds.  The plot should only start when the user presses a start button.

The next part involves giving the user an option to write the generated data to a spreadsheet file called "sine.txt".  The file name and location should be hardcoded.  The file should contain the x and y coordinates of each data point in columns separated by tabs, also known as delimited.

 

I have spent several hours tweaking the attached program and I just can't seem to get it to work right.  Any suggestions would help at this point.

 

Sincerely,

A frustrated chemistry student whose research mentor is out of town 😞

0 Kudos
Message 1 of 5
(7,581 Views)

You are missing the "Sinusoidal Wave.vi" which is what is creating the signal.

 

I don't understand why you have a 240 iteration For Loop in both cases.

I don't understand why you have nearly identical code in both cases with the only real difference as whether the signal goes to a graph or to a file.

0 Kudos
Message 2 of 5
(7,571 Views)

I set the iteration to 240 because the data is supposed to update for 120 seconds at 1/2 second intervals.  The only difference between the code within the true/false cases should be the either writing to an excel text file or not.  That is the issue I'm having problems with.  I wanted the excel files to have tab delimited columns for the x and y coordinated from the graph.  How can I do this?

0 Kudos
Message 3 of 5
(7,555 Views)
Solution
Accepted by ls10728

First, you are not creating Excel files.  You are creating text files.  And it seems that your Write to file is already creating X (time) vs. Y (data curve) that is tab delimited.

 

Everything else you are doing is just too complicated or a Rube Goldberg.

 

All you need is the attached.

Message 4 of 5
(7,548 Views)

Thank you so much!  This helped a lot!

Message 5 of 5
(7,527 Views)