12-02-2008 07:32 AM
Dear colleagues,
I am reading data from a DAQ from 4 channels and am wanting to write the data continuously to an excel sheet. Problem is, I cannot get the sampling rate and # of samples to appear "constant". instead, labview is only sampling x number of samples in a row and storing those to excel. What I want is this:
Beginning at time t=0, and every 0.2 seconds after that (5 Hz), read the values from all 4 channels and append them to an excel file. What I am using is a 1D to 2D array converter and the Write-to-Spreadsheet function outside my while loop. If I set it to only do 1 sample every 0.2 seconds, then it just stays at t=0, just refreshing the value and thus overwriting my excel data. How can I make it sample continuously from t=0 to t=when STOP button is pressed, and then log all samples into excel? I have attached my sample vi below. Thank you.
12-02-2008 08:06 AM
Hi amansari,
you write only the last values into your file (think about the data flow). You can use a shiftregister to build an array with all your values and write this ones to the file, or you write your values every iteration to the file, therefore you have to place the "Write vi" inside the while loop.
Mike
12-02-2008 09:50 AM
Hi Mike, Thanks for replying.
The latter of the two methods you mentioned, " you write your values every iteration to the file, therefore you have to place the "Write vi" inside the while loop.", this would be ideal. What sort of conversions need to be done in the while loop before the data is written? In my file, you can see that I am trying to use a converter to go from Dynamic Data to a 1D array. Would this be the appropriate method for doing this? What I am trying to accomplish can't possibly be this complex, I'm sure lots of people require the use of a similar write-to-spreadsheet function.
12-03-2008 01:24 AM
Hi amansari,
You can also use the DAQmx vi´s to get your data. To write it into a file you only have to move the "Write to Spreadsheet file.vi" inside your while loop and connect your array to it. Connect a true to the append input and a path to your file. If you have performance problems, then store your data over 10 or 20 iterations and write your data block by block.
Mike