GIS data analysis are not the most easy thing in Matlab, though some commands might ease the programming
poly2mask pixcenters projfwd polybool