MATLAB: How to specify points outside a polygon

inpolygonMATLAB

For example, in the below code, I can specify the points inside the polygon. How about outside the polygon? How do I specify that?
IN = inpolygon(lon, lat, x0, y0);
lon = lon(IN);
lat = lat(IN);
ph1 = ph1(IN);

Best Answer

IN = inpolygon(lon, lat, x0, y0);
lon = lon(~IN);
lat = lat(~IN);
ph1 = ph1(~IN);