Clear Filters
Clear Filters

crop or clip matrix shapefile

4 views (last 30 days)
Muhammad Habibie
Muhammad Habibie on 14 Feb 2018
I have matrix 9600x19200 int16 that i want to cut as my shapefile. How could I cut?
I try using this:
I11 = cat(1,I10,I9); %Shapefile t = shaperead('F:\Citra\Shapefile\myshapefile.shp', 'UseGeoCoords', true); % Get x,y locations of pixels: [x,y] = pixcenters(I11); % Convert x,y arrays to grid: [X,Y] = meshgrid(x,y); % Remove trailing nan from shapefile rx = t.X(1:end-1); ry = t.Y(1:end-1); mask = inpolygon(X,Y,rx,ry); figure,imshow(mask,[]); colormap(gca,'jet'); colorbar;
the error : Error using parsePixMapInputs>parseOther (line 66) Function PIXCENTERS expected input number 1, R, to be either a 3-by-2 referencing matrix or a scalar map raster reference object. Instead its size was 9600x19200.
Error in parsePixMapInputs (line 22) [R, height, width, hasFlag] = parseOther(func_name, flagstr, varargin{:});
Error in pixcenters (line 51) = parsePixMapInputs('PIXCENTERS', 'makegrid', varargin{:});
Error in crop_matrix (line 74) [x,y] = pixcenters(I11);
Need some suggestion for crop matrix using shapefile

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!