08-04-2009 10:53 AM
Easy question here
I need save 4 arrays of data and insert the date and time that it was taken (LV 8.6)
for example
9/4/09 10:00:01 AM 4 6 7 2
9/4/09 10:00:02 AM 4 6 7 2
9/4/09 10:00:03 AM 4 6 7 2
9/4/09 10:00:04 AM 4 6 7 2
Any ideas, I can't wire the timestamp or date/time string right into the create array
Thanks
Chris
Solved! Go to Solution.
08-04-2009 11:05 AM
Just a heads up, my data are arrays of DBL
08-04-2009 11:07 AM
Use the "array to speadsheet string" VI to convert the numerics to stirngs then put your time stamps and headers where you need them.
Ben
08-04-2009 11:16 AM
Thanks Ben
How can I save the file then, the write to spreadsheet will not accept the string?
Chris
08-04-2009 11:25 AM
The "write to Spreadsheet.vi" in modern version of LV is polymorphic meaning, it will adapt to the dat type you pass to it. I just checked and it will accept a 2d array of strings.
Ben
08-06-2009 11:32 AM
Ben
I can get it all wired together, the only problem is that the file does not save in the correct order, I am sure that it is an easy fix, I just don't know how to do it. I have attached screenshots of both the text file and my block diagram.
Thanks
Chris
08-06-2009 11:53 AM
All of those shift registers and the creation of 1D Arrays and then the conversion to a 2D array is just a waste. Don't do that. Since you have single elements from the DAQ Assistant and a single date/time, just use a Build Array with all of the scalars as inputs and pass it to the 1D input of Write to Spreadsheet.
Since you did not post the actual VI, you'll have to make the modifications yourself.
08-06-2009 01:50 PM
Dennis
I think I may have been unclear in my intentions, I want to continuously be logging data to a single file. This file would have the first column, date, then time, then four columns of data. The VI that I wrote here stores all that I am looking for, but does not put them where they need to be (see the text file jpeg). I need the columns to consist of the following, rather than a line of date, line of time, and four rows of columns.
Date Time Channel 1 Channel 2 Channel 3 Channel 4
Thanks
Chris
08-06-2009 02:26 PM - edited 08-06-2009 02:28 PM
Ok
the basic problem that I see is the the LabVIEW TimeStamp type is a cluster. Converting it to a dbl gives you a value in seconds elapsed since 1904 Jan 1 12:00AM GMT and, your spreadsheet cannot interprate that (or display that) as a "TIME." So, you want to convert it to a string (easy TS->String check the help for format options) BUT, you might want to pass all of your data as numbers into your spreadsheet so you can post-calculate or graph other outputs vs. TIME! This little chunk of code .....
converts a LV Timestamp to a number that Excel interperates as "the amount of days elapsed since 0 Jan 1900 @ 12:00AM LOCAL." You will need to format the cell in Excel to display it as a date-time But it can be operated on and graphed against with only Excel's limitations (Excel followed the Lotus bug of erroneously assuming 1900 was a leap year, and Leap seconds are unrecognized)
Enjoy!
08-06-2009 04:11 PM
Anyone out there trying to do the same thing I am, I got it to work with the attached VI.