LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Entering continuously measured data into same file

It is not at all clear to me what you are doing, and what you want to do.  I understand that you have three instruments from which you are sampling data, and (ideally) would like to have the data from all three instruments appear (as columns, I presume) in a single file, possibly a LabVIEW Spreadsheet file, possibly an Excel file.

 

Several questions need to be answered:

  • Are all three instruments sampled at the same time, and at the same rate?  [You don't say, but if this is not true, it might not make much sense to have a three-column format ...].
  • What is the sampling rate?  You mention 10 Hz -- do you mean you take one sample from each of the 3 instruments 10 times/second, and all at the same time?
  • How do you want to start and stop the sampling?
  • Do you want to display the data as you are sampling it?  Do you want to display every point?  [If you are sampling at 10 Hz, there should be no problem with doing this].
  • Do you want to start and stop saving data to the file independently from starting and stopping sampling?  [This could allow you to start sampling and displaying, look at the data, see that it is OK (or adjust things until it is), then start recording].

Do you know about the Producer/Consumer design pattern?  You could easily set up a Producer loop that produces a single triple of points (one from each instrument) at 10 Hz, puts them on a Queue, and sends them to a Consumer loop that displays the data and optionally sends the data to an independent Consumer loop for storage to a disk file (format of your choosing).

 

Incidently, purists among us (i, for one) would say that you should not use the word "Excel" if you are talking about LabVIEW's Write to Spreadsheet functions.  If you want to write an Excel file, you need to use the Report Generation Toolkit.  A .csv file can be read by Excel (and Excel likes to make an icon for it), but this is just a particular form of Text file.

 

Bob Schor

0 Kudos
Message 11 of 16
(657 Views)

One you can do is, use 'write spreadsheet' function. You can make multiple columns even if your sampling rates are different. 

 

When ever the event of measurement is encountered, call your file, read it, search for last array element, insert data in specific column at very last index, pass empty data in other columns and write same spreadsheet again without keeping previous data. 

 

It is not actually preferred method, but if time stamp with data are not the issue, and only data is required, you can use this. You will loose time stamp and hense sampling rate.

 

Also, you can write timestamp (two columns at a time, one for time stamp and one for data) in the spreadsheet.

 

Personally, I do not suggest you this method, but it is possible.

 

Regards,

DCKAN


Best Regards,
DCKAN

"We make a Living by what we get. We make a Life by what we give."
0 Kudos
Message 12 of 16
(640 Views)

I am surprised that no one has given the obvious answer for saving your data - TDMS files. The were designed for saving data in an organized way. Once all the data is saved, if you don't like the structure you can read the file and resave it however you like.


Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 13 of 16
(629 Views)

@mikeporter wrote:

I am surprised that no one has given the obvious answer for saving your data - TDMS files.


Especially since you are using DAQmx.  There is a function called DAQmx Configure Logging.  You use that before you run your task and the data is automagically saved in a TDMS file.  You do not need to do any more work.

 

Now back to the VI.  You only need to set up the task once before your loop.  You are currently doing this with every loop iteration.  Likewise, you only need to clear the task once after the loop.  You can then read the data inside the loop as much as you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 16
(612 Views)

Wait a minute -- the original poster, Parissa_wall3, asked a question about writing data from three instruments into a single data file.  Then Ankush appears to have "hijacked" the thread by asking a completely different (but possibly related) question.  Are we all answering Parissa_wall3 (I know I am trying to do so)?

 

Parissa_wall3 -- if you are still following this thread, please respond and let us know your response to those comments that address your original question, and what, if anything, you have to add to this discussion.  If, on the other hand, you are satisfied, you can also say so.

 

Ankush -- consider posting your question as an Original Post.  It will lessen the confusion from simple-minded responders such as I.

 

Bob Schor

0 Kudos
Message 15 of 16
(582 Views)

Thanks for responses, but my question was for many months ago, and I already made it work by moving all data in an array and write it into an excel file after the task is done.

0 Kudos
Message 16 of 16
(533 Views)