| Mapping Toolbox™ | ![]() |
[newlat,newlong] = filterm(lat,long,Z,refvec,allowed)
[newlat,newlong] = filterm(lat,long,Z,refvec,allowed) filters geographic data based upon the corresponding entries of a regular data grid, Z, with a three-element referencing vector refvec. The data locations to be filtered are input in the vectors lat and lon. For those locations corresponding to entries of map equal to one of the values contained in the vector allowed, an output location is returned in newlat and newlon. Those locations not corresponding to such entries of Z are not returned in the outputs.
Filter a random set of 100 geographic points. Use the topo map for starters:
load topo
Then generate 100 random points:
lat = -90+180*rand(100,1); long = -180+360*rand(100,1);
Make a land map, which is 1 where topo>0 elevation:
land = topo>0;
[newlat,newlong] = filterm(lat,long,land,topolegend,1);
size(newlat)
ans =
15 1 15 of the 100 random points fall on land.
![]() | fillm | findm | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |