取消
显示结果 
搜索替代 
您的意思是: 

Waveform chart data saving

已解决!
转到解答

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 项奖励
1 条消息(共 18 条)
10,033 次查看

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 项奖励
2 条消息(共 18 条)
10,027 次查看

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 项奖励
3 条消息(共 18 条)
10,019 次查看

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 项奖励
4 条消息(共 18 条)
10,007 次查看

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 项奖励
5 条消息(共 18 条)
10,000 次查看
解答
已被主题作者 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

6 条消息(共 18 条)
9,992 次查看

 

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

0 项奖励
7 条消息(共 18 条)
9,986 次查看
Thank you two for your answers !
0 项奖励
8 条消息(共 18 条)
9,964 次查看

 


@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 项奖励
9 条消息(共 18 条)
8,537 次查看

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

 

Bob Schor

0 项奖励
10 条消息(共 18 条)
8,530 次查看