MATLAB: How to check if a point (x,y) is either inside or outside a shape in a graph created be a set of experimental points

experimental datainside the shapeMATLAB

I am currently working on a project and what I have is a large set of points that make an irregular shape in a graph (example attached). I want to put that shape in a rectangle (closed space), generate random points (red dots) within that rectangle and see if the random point ends up inside or outside the irregular shape. Since I am working with a set of data and not a function, It makes my life harder to tell if the random points are within the shape. How can I determine if a point is inside or outside the irregular shape?
please help

Best Answer

Read about inpolygon. This will help you to get whether the give point is inside or outside the given closed region.