LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot / open .csv file

Greetings Community

I have the following problem, as a simple amateur, from this example I found in this forum, I was modifying it to graph my .csv files, it turns out that I can separate the columns but I can not plot the time data on the x axis.
The other thing is that once the program is executed and trying to open another file, the latter does not graph it.

Thank you

Download All
0 Kudos
Message 1 of 5
(3,109 Views)

You are using a waveform plot.  What you want is an XY Graph.

 

Take a look at these.  Give it a try and post your attempts 🙂

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/types_of_graphs_and_charts/

 

https://forums.ni.com/t5/LabVIEW/How-do-I-make-an-XY-Graph-plot-points-over-time/td-p/610169

 

0 Kudos
Message 2 of 5
(3,098 Views)

I solved the open file, but I still can not detach in x and y coordinates with the xy chart and since the time I get constant

0 Kudos
Message 3 of 5
(3,055 Views)

Ok, you are getting closer.  As you likely observed, your waveform graph DOES look right for data whereas your XY Graphs do not.  You waveform graph however has incorrect time.

 

To start with, I should apologize. I didn't look at your data initially well enough.  Waveform graph actually will work because you have a constant sample rate (1 khz).. so you can use either an XY Graph or Waveform Graph. Let's look at the two options:

 

Waveform Graph

The trick to making your time look correctly here is going to be the Build Waveform function.  With this you can create a waveform cluster constant and set your dt = 0.001.  Do this for every column (or row once you have transposed your array) of data and then feed it into your waveform graph.  It'll work!

The drawback to using a waveform graph is that you MUST have constantly sampled data.  If you have any dt jitter in your signal it will not plot correctly.

 

XY Graph

Here, you actually need to build your time array.  The data going into an XY Graph is going to be a cluster of 2 elements - your X array and your Y array.  Look at the Context Help of an XY Graph to see this.

 

In order to build your time array you can do two things.  First you could parse your 2nd column of data (time) into an absolute time... or second you could use the ramp function (or a for loop) to just build a time array knowing your dt = 0.001s.

 

Once you have your time array, you can bundle it with your Y axes and it should look correct.

 

Note: Generally when I save a csv file I just start at t = 0 and save that.  Writing a csv with a H:M:S timestamp is generally a bad idea because (as you can tell!) it makes plotting the data later difficult.  A better solution is to write H:M:S start time as a file header, and then storing your time data as seconds since start.

 

You are on the right track though!  Also, you might want to look into the Event Structure.

 

Edit:  Clarity.

0 Kudos
Message 4 of 5
(3,036 Views)

There probably are easier ways to extract the absolute time from the CSV file. But here is one way

 

p.s., I noticed that your Absolute time data is not always increasing constantly over time. There are several instances where the absolute time goes backwards by 0.1 sec.  Probably the way your operating system is obtaining the time. Your XY graph will look a little funny in these ranges. So your best way to display this data is what BowenM suggested, use a waveform graph, and assume your time constant dt = 0.001

 

Convert CSV_Time_Date to Timestamp.png

0 Kudos
Message 5 of 5
(3,024 Views)