03-14-2015 08:08 AM
Hi
Im trying to plot some values that represent data recorded with 5 second intervals. The 2 plots is a mean value and a peak value. I would ideally want a line between the mean values. However in the dataset there's values that equals zero, so my graph drops to zero when this happens.
How can i remove these points from the graph?
I still want to keep the distance as if the point was still there.
Hope someone can help me out here.
/ Maarten
03-14-2015 08:44 AM
You could use a FOR loop to replace all of the elements in the array that are equal to 0 with NaN.
03-14-2015 09:02 AM
03-14-2015 09:35 AM
Your solution will probably not work, as theres is periods where a larger amount of the data is 0. But thanks for the response. I will see if i can find a better way to show the data.
03-14-2015 10:30 AM
You could replace a 0 with the latest previous non zero value. To have a line joining pre and post zero value you need to know the post value and there can be more than 1 consecutive 0 zero, this can get complicated to calculate the line equation and the y value of the point to replace (althought possible).
Ben64
03-14-2015 12:05 PM
I guess we're assuming that the 0's are not real data? Just checking.
03-14-2015 02:34 PM - edited 03-14-2015 02:35 PM
Well its "data" recorded at a specific time that says: ---,- in the .txt file.
So its not really 0, its just data that for some reason is not available at the specific time.
When i use the read from spreadsheet function in Labview the ---,- is converted to 0.
The format in the .txt file is like this, where i'm only interessted in the last two columns:
1 ---- 23.01.2002 09:06:00 70,4 94,7
2 ---- 23.01.2002 09:06:05 ---,- ---,-
3 ---- 23.01.2002 09:06:10 72,3 93,1
So basically what i want is the X axis to represent the time, but not plot when no data is available.
03-14-2015 03:57 PM - edited 03-14-2015 03:58 PM
I like Ben64's idea, then. 🙂
It's not critical, then? The bad data point doesn't need to be flagged as asuch?
03-14-2015 04:20 PM - edited 03-14-2015 04:26 PM
No they don't need to be flagged, just not in included on the graph.
After some considerations i don't think i will implement a line between the data points, just show them as a dot.
So i will go for Ben64/crossrulz solution, to replace the 0's with NaN, so they won't show up on the graph. With this i will still keep my time axis intact. 🙂
03-15-2015 09:14 AM
Could also use an XY plot, since you have time use this real value as the x axis and data as the Y, remove time data pairs where the data is out of range (ie ==0)