From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Date/time to 1d array of data saving as CSV

Solved!
Go to solution

Hi, 

I am new to LabView any help would be highly appreciated.

I need help in adding current time stamp to the data I am receiving as an 1-d array. The array has around 400 elements and I am around 100-110 1-D arrays in a second. I have attached the screenshot where the Divide function is spitting out the data. I have attached the output data with 

Write Delimited Spreadsheet VI component where I am writing the data as an CSV. But I want to add current timestamp with the data I am getting

to the csvCapture.PNG sheet.

0 Kudos
Message 1 of 14
(4,133 Views)

Word of advice. Don't upload photos. They don't tell us much about what's going on.

 

Upload your VI so we can take a look at it.

0 Kudos
Message 2 of 14
(4,131 Views)

I have no idea why you show subVIs as terminals, makes it much less descriptive and unique.

 

How do you want the file structured?

 

Since you are appending rows to the file, you could just make the first two elements as x0, dx information and strip it accordingly when reading the file. (If x0 and dx os always the same, you could write a header line once at the start of the program instead)

 

specialSave.png

0 Kudos
Message 3 of 14
(4,093 Views)

Hi,

I was not sure on how to edit the message so i am posting my VI here and excel sheet.

In the excel sheet I just want to add the timestamp of the data when it is writing to the csv or when it is reading from the sensor any of them would work for me. Each row 400 data values so I want to add the first columns as time columns for each row.

And how to save a new excel sheet every time the program starts as of now the excel sheet is saving at in one csv file.

 

Download All
0 Kudos
Message 4 of 14
(3,994 Views)

Hi @Eric1977, thanks for a quick reply. 

I have added the vi in the comment below can you have a look on that.

Thanks!

 

0 Kudos
Message 5 of 14
(3,992 Views)

Hi @altenbach, thanks for your reply.

I have posted the Vi and screenshot of the excel sheet how it is looking now and just want to add timestamp at every new row of data to be written.

Thanks!!

0 Kudos
Message 6 of 14
(3,988 Views)

@ish07 wrote:

I have posted the Vi and screenshot of the excel sheet how it is looking now and just want to add timestamp at every new row of data to be written.


You want an absolute or relative timestamp? You can convert a timestamp to a DBL and prepend it to each new row. I think excel uses a different epoch, so you would need to add a few tweaks.

 

Alternatively, you could format the data as string and also convert the numeric array to strings and write a 1D string array with each iteration. How do you want the timestamp formatted?

0 Kudos
Message 7 of 14
(3,967 Views)

Here's a starting point:

 

AddTime.png

or pick any time format (default is %c):

 

AddTime2.png

 

0 Kudos
Message 8 of 14
(3,959 Views)

Hi altenbach,

Thanks for your help. Actually I am fine with any format of datetime.

I tried with the block diagram as you suggested but i am getting two errors on that, I have attached a screenshot of the same. Can you please help me with that. 

I have also attached the screenshot of the error messages.

Download All
0 Kudos
Message 9 of 14
(3,916 Views)

Try this:

 

TimeToOLE.png

Now your timestamp is a floating point number you can write to your CSV file.

Then on whatever spreadsheet program you use you can format this OLE timestamp 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 14
(3,894 Views)