gridColors = [0.7 0.7 0.7; 0.0 0.0 0.0; 1.0 1.0 0.0; ...
              0.0 0.0 1.0; 1.0 1.0 1.0; 0.7 1.0 0.7; ...
              0.5 1.0 0.5];

emptyCellColorIndex = 1;
obstacleCellColorIndex = 2;
startCellColorIndex = 3;
targetCellColorIndex = 4;
currentCellColorIndex = 5;
evaluatedCellColorIndex = 6;
pathCellColorIndex = 7;


mapGrid = ...  %% Example
[1 1 1 1 1 1 1 1 1; ...
 1 1 1 1 2 2 2 1 1; ...
 1 1 1 1 2 1 1 1 1; ...
 1 1 1 1 2 1 1 1 1; ...
 1 1 1 1 2 1 1 1 1; ...
 1 1 1 1 2 2 2 1 1; ...
 1 1 1 1 1 1 1 1 1]; 

startX = 3;
startY = 2;
targetX = 6;
targetY = 7;

mapGrid(startY,startX) = startCellColorIndex; %% NOTE! (Y,X) not (X,Y)!
mapGrid(targetY, targetX) = targetCellColorIndex;

%% ... etc. ...

plotHandle = image(mapGrid,'erasemode','xor');
colormap(gridColors);
axis equal;
drawnow;
