07-06-2016 08:43 AM
Hi all,
I have written a VI that takes data continuously and writes it to a queue. At a threshold cross trigger, it takes 1 additional second of data and then flushes the queue into an excel file. My problem is that when the data is exported, the headers I have programatically set for each column show up again every 100 or so data points in my output excel sheet. Can someone enlighten me as to why this is happenning? I have attached my VI and a sample data sheet output.
Thanks,
Guy
Solved! Go to Solution.
07-06-2016 08:59 AM
I have used excel using activex control where we can use properties and methods to get our requirement done and i have nt used Report generation Tool kit with extensively.
so its Just a idea and from my past experience
Try to write empty values with Headers in the intialize state and the start to log the data without Feeding header
This may work good for you
07-06-2016 09:03 AM
You set Samples per Channel to 100. In User State 1, you save these 100 samples to Excel, and specify the column headers. So every time you save 100 samples, you tell Excel to write another set of column headers!
There's an easy fix. Put the Column Header information in a Shift Register, set it in the Initialize State, and make it an empty array in User State 1, so it will only be defined for the first time you save 100 samples.
Bob Schor
07-06-2016 09:09 AM
Oops, sorry I didn't see your message until just now. I implemented the header write during the initialize state and it worked beautifully. Thank you!
@Bob_Schor, that method sounds equally as good. Thank you for your input.
Guy
07-06-2016 09:09 AM - edited 07-06-2016 09:10 AM
Bob is correct and that is the right way to do it. You are writing the headers every time you write data, which is every 100 samples.
Now, there are other issues with your code. I suggest you get rid of your Queue, because it isn't helping you at all. Instead, add your data to an array that you pass in a shift register like the rest of your info.
The way you have it now, you are actually losing all of your data except for the last queued element.
Right here, you're flushing your queue, then iterating through the queue elements, but then only using the last element. This may be fixed by setting the output terminal to Concatenating.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-06-2016 09:15 AM
Thank you! I was wondering why my data was so small. I'm still working through a few bugs in my VI.
I am using a fixed size queue for the purpose of retaining only 2 seconds of data, however. I want the limit cross to trigger 1 more second of collection and then dump it all into the excel file. I will be collecting data at an extremely high rate at the time of the test, so I want most of it to be dumped as the VI runs. I am recording data surrounding an impact on a tank, which will be collected with accelerometers that give off a variable voltage reading (after going through a signal conditioner). How can I implement this without the queue, since you say it is not helping me at all?
Guy