4.2

4.2 | 5 ratings Rate this file 11 downloads (last 30 days) File Size: 2.15 KB File ID: #7187

inpolygons

by Kelly Kearney

 

18 Mar 2005 (Updated 21 Mar 2005)

Code covered by the BSD License  

Finds points inside multiple polygons, holes possible.

Download Now | Watch this File

File Information
Description

This function is similar to MATLAB's inpolygon function, but allows the polygon vertices to describe multiple polygons, and allows these polygons to have holes in them. In the case of multiple polygons, it also returns the index of the polygon in which a point was found.

Required Products Mapping Toolbox
MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
15 Apr 2005 peng wenmin  
12 Jan 2006 Eleonora Vidolova  
18 Jan 2006 Gennady Khokhorin

Thanks, nice work!

01 Mar 2007 Matt K.

Works perfectly and very quickly!
The Mapping Toolbox saves me again!

22 May 2007 Ben G

Got an error just running the example.

??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.

Error in ==> polysplit at 35
if ~isnan( lat(length(lat)) ); lat = [lat; NaN]; end

Error in ==> inpolygons at 59
[xsplit, ysplit] = polysplit(xv, yv);

23 May 2007 Kelly Kearney

Ben,

What version of Matlab are you running? The example runs fine on my computer, R2007b (Mapping Toolbox 2.4). But the line numbers you list don't agree with either of my copies of the code (the inpolygons line you note as 59 is line 69 in the code offered here, and the line you note in polysplit doesn't appear at all in my version of polysplit.m).

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
approximation Kelly Kearney 22 Oct 2008 07:43:37
interpolation Kelly Kearney 22 Oct 2008 07:43:37
polygon Kelly Kearney 22 Oct 2008 07:43:37
polygons Kelly Kearney 22 Oct 2008 07:43:37
mathematics Kelly Kearney 22 Oct 2008 07:43:37
approximations Kelly Kearney 22 Oct 2008 07:43:37
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com