%% Sync Map With an Overlapping Map
% This example shows how to sync two overlapping maps using the syncWith function.
% 2-D occupancy maps are used to represent and visualize robot workspaces. In this example 2-D occupancy maps are created using existing map grid values stored inside exampleMaps.mat.

load('exampleMaps.mat');

% Create and display a new empty 2-D occupancy map object using binaryOccupancyMap function.

map1 = binaryOccupancyMap(70,70); 
show(map1) 
title('New Map')

% Create and display 2-D occupancy map using the map grid values stored in complexMap.

map2 = binaryOccupancyMap(complexMap); 
show(map2)
title('Complex Map')

% Now update map1 with map2 using the syncWith function.

syncWith(map1,map2);
show(map1)

% Copyright 2020 The MathWorks, Inc.