annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Waveform chart data saving

Risolto!
Vai alla soluzione

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
Messaggio 1 di 18
10.091Visualizzazioni

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
Messaggio 2 di 18
10.085Visualizzazioni

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
Messaggio 3 di 18
10.077Visualizzazioni

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
Messaggio 4 di 18
10.065Visualizzazioni

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
Messaggio 5 di 18
10.058Visualizzazioni
Soluzione
Accettato da 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

Messaggio 6 di 18
10.050Visualizzazioni

 

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

0 Kudos
Messaggio 7 di 18
10.044Visualizzazioni
Thank you two for your answers !
0 Kudos
Messaggio 8 di 18
10.022Visualizzazioni

 


@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
Messaggio 9 di 18
8.595Visualizzazioni

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

 

Bob Schor

0 Kudos
Messaggio 10 di 18
8.588Visualizzazioni