09-23-2016 08:52 AM
Hello, I've been having an issue with trying to save my data to an excel file. I'm pretty new to labVIEW, so I used the DAQ Assistant to set up my data aquisition (I have been told it's not ideal, but I don't have the time to learn how to change it, nor is it a problem right now).
I have the DAQ Assistant and all of the data within a while loop, so that the unit continuously records data until I tell it to stop, but this becomes an issue when I want to save the data to an excel file.
When I run the VI, the report generator will save the file every time the while loop runs through once. So, if I'm collecting data at 100 HZ for 10 seconds, I will get 10 excel documents each with 100 rows of data, rather than one document with 1000 rows of data.
Is there any report generation item I can use to hold onto the data and build one large table until I am ready to dump it all into one document? I've tried tinkering with several different methods of doing this, none of which are proving useful...
09-23-2016 09:15 AM
There are a number of "signatures" that show you are very new to LabVIEW.
Bob Schor
09-23-2016 09:23 AM
When you are ready for a slightly more advanced treatment, consider the following:
Now, there's a problem caused by Data Flow -- we're now trying to do two things inside a single loop, collect some data and save it to a file. We can't "loop" until both are done -- what if the writing slows things down so that we "miss" some data points?
LabVIEW (and Data Flow) to the rescue -- you need to do the Acquiring and Saving in completely separate, largely-isolated, loops that, if they have no dependency, will run "in parallel". While the DAQ loop is "waiting for the hardware to finish", the Write loop is telling the disk what to do (and letting it do it on its own time). This is something called the Producer/Consumer Design Pattern, which you can learn about by doing the following:
Bob Schor
09-23-2016 09:23 AM
I've had someone more familiar with LabVIEW look it over, and he gave me many pointers on things that aren't good habits, but again, I'm new to this, BUT, these things (I dont think) are causing me any issues).
I don't think that only the final table is passed, because if I run the program for a little bit I usually wind up with 20+ excel files open.
I'm not sure I follow what you mean about an indexing tunnel, but that does sound like what I'm trying to do.
09-23-2016 09:26 AM
That all sounds like what I'm trying to do, a bit overwhelming, but sounds about right. I'll give it a shot, thanks!
09-23-2016 09:52 AM
Is one of your Express VIs also writing to Excel? If so, it is the culprit! Get rid of it -- you do not want to be opening/writing/closing Files within the loop.
[One reason I so dislike Express VIs is that you cannot easily tell what they are doing. I also don't like Dynamic Wires ...]
Bob Schor
09-23-2016 10:35 AM
I guess I misunderstood what the write to excel VI does, I thought it just converted the data so that it can save to excel rather than a basic text file...
09-27-2016 10:42 AM
After spending some time with the Consumer Design Pattern (Data) template, I cannot figure it out... I don't understand what most of the things do....
My biggest question is why are we feeding data into a data generator?