LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove 0's from Graph

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.

Capture4.PNG

 

 

/ Maarten 

0 Kudos
Message 1 of 10
(5,589 Views)

You could use a FOR loop to replace all of the elements in the array that are equal to 0 with NaN.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(5,570 Views)

crossrulz a écrit :

You could use a FOR loop to replace all of the elements in the array that are equal to 0 with NaN.


That will remove the zeroes but there will be no lines between the pre and post zero data (an acceptable solution in my mind if the frequency of 0 appearance is low).

 

Ben64

0 Kudos
Message 3 of 10
(5,560 Views)

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.

0 Kudos
Message 4 of 10
(5,547 Views)

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

 

 

Message 5 of 10
(5,534 Views)

I guess we're assuming that the 0's are not real data?  Just checking.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 10
(5,520 Views)

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.

Message 7 of 10
(5,510 Views)

I like Ben64's idea, then.  🙂

 

It's not critical, then?  The bad data point doesn't need to be flagged as asuch?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 10
(5,487 Views)

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. 🙂

0 Kudos
Message 9 of 10
(5,478 Views)

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)

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 10 of 10
(5,438 Views)