LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write data at different rates to spreadsheet

Solved!
Go to solution

Hi,

 

I'm using the "write delimited spreadsheet" VI to write 20 or so different values (of different types) into equally many columns at a fixed rate. Every now and then I would like to write a value to another column, but only when this value is available (due to other conditions). If i bundle this value with the other values, it will only write data when all values are available, which is not what i want. Is there a way to do this without too much headache ? 

 

One solution I can think of is to just write empty strings while the irregular value is not available, but then I would get alot of blank spaces in the spreadsheet which is not ideal. 

0 Kudos
Message 1 of 6
(1,206 Views)

Think about an Excel Workbook.  Assume you have twenty values, call them A through T, that you gather once a minute, and an "unusual value" (call it U) that you gather at various random times.  Let's assume that T = Time (in minutes).  Think about what an Excel Worksheet that had columns A through T would look like, and what the Worksheet would look like if you made it A through U.  When an Unusual value was seen, you'd write it in a "Row of its own" with blank entries in A through T and the U value in Column U.  There's nothing basically wrong with this, and you can even estimate the Time from the previous (or succeeding) row's T value (or you can just write both a T and a U entry, which might make more sense).

 

Now, suppose you look at this Excel Workbook and say "This A-through-U Worksheet is ugly with all these semi-blank rows that break up the A-T view of "most of the data".  What can you do (in Excel) to get rid of those "almost-blank rows" without losing the "T-U" data?  [Answer to be supplied by the Reader of this post].  Well, can you do this with the Report Generation Toolkit in Excel?  [The answer, I hope, is "Yes"].

 

Bob Schor 

0 Kudos
Message 2 of 6
(1,191 Views)

Thanks for the thorough reply! I was looking at the Report Generation Toolkit before but unfortunately I don't seem to have a license for it. Right now my workaround is to just search the U-array in the post-processing to find the unique values (which then ignores all blanks) which might be what you were hinting at. It seems a bit brute force to me and I was hoping for a more elegant solution (without Report Generation). But then again, if it's not broken, don't try to fix it I suppose 🙂 

 

Thanks again!

0 Kudos
Message 3 of 6
(1,188 Views)
Solution
Accepted by topic author krissven

OK, that's not at all what I imagined, nor was thinking about.  So let's forget about Spreadsheets (I was assuming you might be doing something like "Write Delimited Spreadsheet").  If you have one set of 20 channels and an occasional set of 2 channels (one channel of "data" and one of "time of occurrence), then the "neater" way to handle the "occasional" values is to write two data files, "Predictable Data" and "Unpredictable Data" (there's our friend U, again).  At "analysis time", you read both, and "do what needs to be done" with the U data.

 

Bob Schor

Message 4 of 6
(1,179 Views)

Another solution would be to use TDMS. I have found that the Excel TDMS plugin results in nice spreadsheet files when there is like and unlike data.

0 Kudos
Message 5 of 6
(1,101 Views)
Solution
Accepted by topic author krissven

I like TDMS files for this.  You have a different group for each of the different logging rates.  When opened in Excel this looks like different worksheets for the different rates.  I will usually have the first column (TDMS Channel) be something like Time, and have it be the time and date a sample was taken.  Or have a Total Time which is seconds from the start of the logging process.

 

If you stick with a text file writing blanks works, but I'd rather suggest you hold the last value until a new value comes in.

Message 6 of 6
(1,093 Views)