I often find myself trying to search cell arrays like I would want to search a database with a sql query. In this case, I've got a number of military bases (bases.shp)
bases = shaperead('us-military-bases.shp')
and then I want to filter down the shape file to get Air Force bases, something like regexp({bases.FAC_NAME}','Air Force')
. But the output I get is the fairly cumbersome:
[]
[]
[ 4]
[]
[]
[ 9]
[]
I am sure filtering down cell arrays or shapefiles is pretty common and there have to be some good practices. Thanks for any insight.
I am also trying things like:
trif = arrayfun(@(x)regexp(x.FAC_NAME,'Griff','match'),af_bases)