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
Highlighted

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 13
(324 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 13
(322 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


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 3 of 13
(284 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.

 

0 Kudos
Message 4 of 13
(185 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 13
(183 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 13
(179 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?


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 7 of 13
(158 Views)

Here's a starting point:

 

AddTime.png

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

 

AddTime2.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 8 of 13
(150 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.

0 Kudos
Message 9 of 13
(107 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 

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 10 of 13
(85 Views)