Assuming you have data in x and y coordinates (switch x and y with lon and lat, if you're using geocoordinates), start by preallocating some empty matrix the size of your full x,y grid:
MyMap = zeros(mapheightpx,mapwidthpx);
where mapheightpx and mapwidthpx are the size of the categorical data map you'll be creating. Set red circle areas to 5 and green to 3:
red = inpolygon(gridx,gridy,redcircleoutlinex,redcircleoutliney);
MyMap(red) = 5;
green = inpolygon(gridx,gridy,greencircleoutlinex,greencircleoutliney);
MyMap(green) = 3;
3 Comments
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/194948-assigning-property-value-to-image-color-oklahoma-state#comment_274981
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/194948-assigning-property-value-to-image-color-oklahoma-state#comment_274981
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/194948-assigning-property-value-to-image-color-oklahoma-state#comment_274990
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/194948-assigning-property-value-to-image-color-oklahoma-state#comment_274990
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/194948-assigning-property-value-to-image-color-oklahoma-state#comment_275005
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/194948-assigning-property-value-to-image-color-oklahoma-state#comment_275005
Sign in to comment.