# How to convert a shapefile to binary grid?

I have a polygon shapefile with a UTM projection which I read into MATLAB:

s = 'C:\path\to\shapefile.shp'



How can I convert this simply polygon into a binary raster grid of 0's and 1's in MATLAB? My goal is to multiply the binary grid/array by another array to "mask" out areas outside my region of interest.

-
maybe poly2mask could help (after extracting X and Y from your struct array). –  radouxju Mar 5 at 7:55