01-30-2019 12:39 PM
I would like to create a VI that records position data and plots it in real-time. I will be receiving 0 values for some data points, but I would like to filter out those zeros to either:
1. use the previous, non-zero value, or
2. Or omit the zero from the waveform chart
Is there a recommended architecture or function that could do this?
Solved! Go to Solution.
01-30-2019 01:09 PM
Things to consider:
Determine what "zero" actually is. Is your data actually integer values where you can check for an exact zero value or is it represented by single or double datatypes? If integers, you can use the "equals zero" comparison primitive. If single or doubles, I would recommend using the "in range?" comparison so that you can define the zero value tolerance with upper and lower limits. If you want to repeat the last know "good" value, your application will need some form of memory which could be accomplished by using a shift register or feedback node. If you want the value to be omitted on the waveform chart but still keep the time axis consistent, you can feed the chart a "NaN" value. This will only work for waveform charts of single, double, or waveform datatypes.
01-30-2019 01:13 PM
Hi Leroi,
I will be receiving 0 values for some data points,
Most often this is a problem of a badly designed receiver algorithm.
Does your data source really send those "zero" values?
but I would like to filter out those zeros to either:
01-30-2019 05:26 PM
Just to be thorough, you are absolutely certain that zero cannot be a valid data point?
01-31-2019 10:11 AM
Hi Bill
Yes, the data point represents the position of a valve. A zero value means the valve is fully closed, and I can physically see the valve is not closed. Also, when using software that accompanied the valve, the zero value does not appear.
01-31-2019 10:15 AM
Ah thank you. I combined all the options you mentioned. The data points came in the form of strings, which I parsed and converted into doubles. Then I used a shift register and an "equals zero" Boolean to use the previous value if true, and use the current value if false.