LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read excel date and time and plot with timestamp in x-axis

Thank you Bob. 

One-day version is sufficient. 

0 Kudos
Message 11 of 12
(510 Views)

OK.  Here's what you do:

  • Fix the Excel file.  It must contain exactly 2 columns and 1441 rows.  Select all the columns to the right of the first two and right-click Delete them.  Now select columns A and B starting at the first blank row and delete to the end of the WorkSheet, "shift cells up".  Save.  Reopen, it should stop at Row 1441.  You need to do this because LabVIEW's Excel Get Data "asks" Excel how much data to get, and unless you specify, it "gets it all" (and as saved, thinks there are >90K rows).
  • Do the usual with RGT -- New Report, specifying Excel and your (repaired) data file, Excel Get Data as 2D Array of strings, Excel Dispose Report (because you don't need Excel any more).
  • Delete the first Row (the header).  You should have a 2x1440 Array of Strings.
  • Pass it into a For loop using an indexing tunnel (the default).
  • Inside the loop, you need two Scan from String functions to read the first two strings and convert them to Floats.  You could have specified Floats in the Excel Get Data, but it would have truncated the data to two decimal places.
  • Recall that Excel Times are in Days, so if you want Minutes, you need to multiply by 1440 (minutes/day) and round.
  • Bundle Minutes and the Y value into a Cluster, pass out through an Indexing tunnel to give you an Array of X,Y pairs, and plot on an X, Y Graph.  You should get this:

Excel Data, Graph.png

 

Bob Schor

 

0 Kudos
Message 12 of 12
(502 Views)