04-07-2015 02:44 AM - edited 04-07-2015 02:46 AM
i am working on reading data from excel file and plot it on x-y chart. the sample excel file i have attached. the first commmn will be time stamp and next are different analog channels. i want to plot the time stamp on x-axis and and the channels on y-axis. i have tried related examples and posts but i could not reach up to the mark. is there any simple way to do this?
Solved! Go to Solution.
04-07-2015 07:57 AM
Can you post the code you have tried so far?
04-07-2015 08:17 AM
here are these two files on which iam working. As i am continuouely working on this, these are the last modified one. And the excel file is as above. i hope this will be enough. Am i working on right track???
04-07-2015 08:49 AM
Unfortunately I only have LabVIEW 2013 installed on my computer.
04-08-2015 07:51 AM
i am unable to give time stamp value from 1st column of excel to X-axis of
graph.i have attached the vi in which i have tried 3 different ways along with excel.
somebody kindly look into this and help me to proceed on right option.
04-08-2015 11:47 AM - edited 04-08-2015 11:53 AM
Here's one way of doing it. I did this very quick, so there's always a better way. I have convert your *.xlxs to a *.csv file to simplify things. Make sure you take care of the DST (daylight saving times).
Let me know if you have questions.
(To use the VI below, drag the image to your Desktop and then drag the image from your Desktop to the block diagram of an empty VI)
04-08-2015 04:38 PM
Just because a .csv file is displayed with an Excel-looking icon, it does not mean that this is an Excel file! You are not opening the file in Excel, but rather reading it as a pure text file, which means you (the Programmer) have to parse the TimeStamp values and return some number (seconds since 1 Jan 1904?).
I strongly suspect (and will try to test out this evening) that if you use LabVIEW's Report Generation Toolkit to read these data into Excel and get Excel to give the data back to you, you may have plottable data.
Bob Schor
04-08-2015 10:47 PM
Well, I did try. The problem I'm having is with the LabVIEW TimeStamps, which are stored in a fairly proprietary NI format that doesn't "play well" with Excel's Time format. The problem of getting data into and out of Excel with the Report Generation Toolkit is actually fairly simple -- a function to open the file, a function to read all of the data into a 2D array, and a function to close it. Then you do what you want with the array.
It's getting late here, and my brain is a little fried. I actually did get an idea while composing this Post that may provide a solution -- I'll have to play around a bit.
Are you generating the Data Files using LabVIEW? Do you need to write Date/Time values, as opposed to "elapsed time" (the difference of two TimeStamps, which I believe is a Dbl -- yep, it's the number of seconds between the two TimeStamps.
Bob Schor
04-09-2015 11:25 AM
This turned out to be an exceedingly difficult problem, primarily because (a) I was using Excel ("real" Excel), (b) I was writing Time data, and (c) LabVIEW and Excel handle Time differently (LabVIEW in Seconds, Excel in Days).
However, I came up with a routine that did the following:
This is a lot of work to save and recover LabVIEW TimeStamp information in an Excel Worksheet. By writing both the numeric and String representation to Excel, you gain the ability to "see" the Time data in the Worksheet, yet preserve the precision in LabVIEW without having to write a function to convert Excel to LabVIEW TimeStamps (I tried doing that several years ago -- it was sufficiently difficult that I decided to not use TimeStamps with Excel).
Bob Schor
04-09-2015 11:32 AM
http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Promote-Functions-on-Timing-palatte/idi-p/1672870
A great Idea that will never be implemented
https://decibel.ni.com/content/docs/DOC-19689
Functions to convert timestamps to or from Excel epoch
Caution: the vi.s were developed in CST US you may need to adjust the timestamp constant on the BD for your local zone (Timestamps don't travel well and the epoch for Excel is LOCAL!