LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

skip data points

Hi there,

In attached VI one can see a dataset from which I want to remove some data points.

I already removed the points far away from the shape I'm interested in but I struggle with some others Smiley Sad

 

When you zoom the XY graph in region (X: 0 to 25 and Y: 47 to 75) or (X: 80 to 120 and Y: -5 to -30) one can see that the data points doesn't form a smooth line. It's just like if there are some "bulge" in those area's. I want to get rid of those “bulges”!

Basically I want to keep the data points that forms the smooth inner shape and remove the outer ones.

They can be deleted, no need to replace them by something else.

 

Any idea how I can do that ?

 

Thanks for any reaction.

 

Please note that I’m using LV8.6.

0 Kudos
Message 1 of 6
(3,515 Views)

I can think of two ways to do this.  I'm assuming you can "identify" the points that need to be removed, that is, you can form an array "RemoveMe" with indices (plural of index) of the X and Y points that you do not want to display.

 

Since X and Y are arrays, one solution is to simply use the Delete from Array function to remove the unwanted points.  The caveat here is that if you remove, say, point 1, then all the indices of the higher points will change (i.e. old point 2 will become new point 1).  The solution to this is to reverse your RemoveMe list of indices so you remove points from the end of the array first, thereby not messing up the index of earlier points.

 

A simpler solution (when you have Dbl data, as you do here) is to, instead, use Replace Array Subset and replace the "bad" X and Y values with NaN (Not a Number).  This simply doesn't plot.  The advantage here is that your array stays the same size, making indexing simple.

 

Let us know if this fixes your problem.

0 Kudos
Message 2 of 6
(3,484 Views)

The problem is to identify the points that makes the shape un-smooth.

Deleting is not an issue, there are "50 ways to delete elements from arrays", you gave us 2 Smiley Happy

In attached VI; use the "Idx" control to scroll manually through the data points or press the "Auto" button to do it automatically.

You will se that there is almost no difference in both X and Y data between the datapoints I want to keep and those who un-smooth the shape.

0 Kudos
Message 3 of 6
(3,469 Views)

Hello Alain,

 

The first thing that popped into my mind when reading your post was curve fitting.

 

This gives you the curve y=curve(x)

 

The second thing was eliminating the elements with an absolute deviation from the curve that is bigger than a certain percentage (eg. 5%).

 

In dummy code:

 

Delete sample(x) if  ( |sample(x) - curve(x)| / |Curve(x)| > 0.05)

 

How you do the curve fitting is something else 🙂

 

There are alot of options.

An overview of some of those options can be found over here:

http://www.ni.com/white-paper/6954/en

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 6
(3,458 Views)

Hi Thierry,

 

I already tried the cubic spline fit but since all data points are changed I was not satisfied.

So I will give you're "Compare & Delete" step a try... ...

What troubles me more is the "Balance" parameter for the cubic spline, it influences the result enormously.

I had rather good results with the factor 1e-7, try to explain that to the final user of the software Smiley Sad

 

I started this thread in the hope of a parameter-free-solution... ... ...

Maybe I'm a dreamer Smiley Happy

0 Kudos
Message 5 of 6
(3,437 Views)

Hello Alain S,

 

With an averaged measurement you might be able to get a looser fit.

 

With a single set of values it's quite difficult to get "nice and smooth" graphs.

Noise (amongst all kinds of influences) can quite often be a big source of "peaks"...

 

Please let me know if I can help you with anything.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 6 of 6
(3,432 Views)