www.gusucode.com > robotics 案例源码程序 matlab代码 > robotics/SetOccupancyValuesExample.m
%% Set Occupancy Values % Set the occupancy of grid locations using |setOccupancy|. %% % Initialize an occupancy grid object using |BinaryOccupancyGrid|. map = robotics.BinaryOccupancyGrid(10,10); %% % Set the occupancy of a specific location using |setOccupancy|. setOccupancy(map,[8 8],1); %% % Set the occupancy of an array of locations. [x,y] = meshgrid(2:5); setOccupancy(map,[x(:) y(:)],1);