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: 

Waveform chart data saving

Solved!
Go to solution

Hi,

 

I'm trying to collect temperature data with the attached VI. Everything works fine until I open the exported file, which contains only the last point of the chart. I already had this problem and I think it's quite common but I can't find how to solve it.

Thank you for your help !

0 Kudos
Message 1 of 18
(7,433 Views)

The input of your write to text file function is connected to the last data read.

If you want to save every data point acquired you need to write after every read.

Or you can store the data read temporarily before writing, at the end but that could cause memory problems.

 

Best regards

 

Etienne

0 Kudos
Message 2 of 18
(7,427 Views)

Thank you for your answer

But in this simple program (I think it's the same configuration), all the data is acquired in the file. What is the difference between that and my program ?

And how can I write after every read ?

0 Kudos
Message 3 of 18
(7,419 Views)

You are right.

Notice the difference in the indicator going outside the Loop.

In you program it is a simple square whereas in the exemple it is a square with a white background.

This means that in the case of the exemple the output is an array.

 

If  you want to convert the output of the loop to an array right click on ot and select Tunnel mode>indexing

Your output wire after the loop will contain an array with all the points you want to write.

 

 

0 Kudos
Message 4 of 18
(7,407 Views)

But in my program, it's already an array inside the loop, because I have several sensors. If I activate indexing, it adds a dimension to the array (not sure about that), and it doesn't create a file with : | time | temperature 1 | temperature 2 | ... |. Instead it is many arrays of just one line.

I don't know if I explain it well, I can give you more details if you want.

0 Kudos
Message 5 of 18
(7,400 Views)
Solution
Accepted by topic author simchoots

Here's what you do.  The middle loop is where you get multiple Waveforms.  You want to write each Waveform to the output file, which means you want the Write Waveform to Spreadsheet in the middle loop.  Look at its Inputs and Outputs -- put three of them, File Path/New File Path, Append to File?, and Header? on Shift Registers.  Initialize (means wire to the Shift Register from the outside of the While Loop) the File Path to "data\test" (as you've already done), with the New File Path going to the "output" Shift Register Terminal.  Wire False (default) to Append to File? and True (if you want Headers) to Headers?.  On the "Output" side of the these two Shift Registers, wire "True" to "Append to File?" and "False" to "Headers?".

 

So the first time you run the middle loop, the File will be opened as a New File (since Append to File? is false) and a Header optionally written.  All later calls will Append the data to the same File (because you wired "True" to Append to File on the output terminal) and no Header.

 

And get rid of the unnecessary Frame at the end -- Data Flow will handle sequencing.

 

Bob Schor

Message 6 of 18
(7,392 Views)

 

Bob gave a better answer than the one I was writing......

0 Kudos
Message 7 of 18
(7,386 Views)
Thank you two for your answers !
0 Kudos
Message 8 of 18
(7,364 Views)

 


@Bob_Schor  escreveu:

Here's what you do.  The middle loop is where you get multiple Waveforms.  You want to write each Waveform to the output file, which means you want the Write Waveform to Spreadsheet in the middle loop.  Look at its Inputs and Outputs -- put three of them, File Path/New File Path, Append to File?, and Header? on Shift Registers.  Initialize (means wire to the Shift Register from the outside of the While Loop) the File Path to "data\test" (as you've already done), with the New File Path going to the "output" Shift Register Terminal.  Wire False (default) to Append to File? and True (if you want Headers) to Headers?.  On the "Output" side of the these two Shift Registers, wire "True" to "Append to File?" and "False" to "Headers?".

 

So the first time you run the middle loop, the File will be opened as a New File (since Append to File? is false) and a Header optionally written.  All later calls will Append the data to the same File (because you wired "True" to Append to File on the output terminal) and no Header.

 

And get rid of the unnecessary Frame at the end -- Data Flow will handle sequencing.

 

Bob Schor


I am haveing the same problem. I tried to understand what the Bob Schor explained here, does anybody have any simple schematic to show this above explanation? 

0 Kudos
Message 9 of 18
(5,937 Views)

The Bob Schor says "Attach your Code and someone will point out how to fix your error".

 

Bob Schor

0 Kudos
Message 10 of 18
(5,930 Views)