Application4 PDF
Application4 PDF
AppBase
function updateRobotPosition(app)
% Other methods...end
end
end
delete(app);
end
% Clear the grid and update with the robot's new position
app.Grid = zeros(gridSize, gridSize);
app.Grid(app.RobotX, app.RobotY) = 1; % Place robot at new position
end
end
% Component initialization
methods (Access = private)
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.Position = [184 143 274 172];
% Create RobotSimulatorLabel
app.RobotSimulatorLabel = uilabel(app.UIFigure);
app.RobotSimulatorLabel.FontWeight = 'bold';
app.RobotSimulatorLabel.Position = [246 445 159 22];
app.RobotSimulatorLabel.Text = 'Robot Simulator';
% Create Panel
app.Panel = uipanel(app.UIFigure);
app.Panel.Title = 'Panel';
app.Panel.Position = [54 350 545 71];
% Create NumberofTargetsEditFieldLabel
app.NumberofTargetsEditFieldLabel = uilabel(app.Panel);
app.NumberofTargetsEditFieldLabel.HorizontalAlignment = 'right';
app.NumberofTargetsEditFieldLabel.Position = [1 10 104 22];
app.NumberofTargetsEditFieldLabel.Text = 'Number of Targets';
% Create NumberofTargetsEditField
app.NumberofTargetsEditField = uieditfield(app.Panel, 'numeric');
app.NumberofTargetsEditField.ValueChangedFcn =
createCallbackFcn(app, @NumberofTargetsEditFieldValueChanged, true);
app.NumberofTargetsEditField.Position = [120 10 100 22];
app.NumberofTargetsEditField.Value = 10;
% Create GridsizeEditFieldLabel
app.GridsizeEditFieldLabel = uilabel(app.Panel);
app.GridsizeEditFieldLabel.HorizontalAlignment = 'right';
app.GridsizeEditFieldLabel.Position = [360 10 52 22];
app.GridsizeEditFieldLabel.Text = 'Grid size';
% Create GridsizeEditField
app.GridsizeEditField = uieditfield(app.Panel, 'numeric');
app.GridsizeEditField.ValueChangedFcn = createCallbackFcn(app,
@GridsizeEditFieldValueChanged, true);
app.GridsizeEditField.Position = [427 10 100 22];
app.GridsizeEditField.Value = 10;
% Create UPButton
app.UPButton = uibutton(app.UIFigure, 'push');
app.UPButton.ButtonPushedFcn = createCallbackFcn(app,
@UPButtonPushed, true);
app.UPButton.Position = [283 83 100 23];
app.UPButton.Text = 'UP';
% Create DOWNButton
app.DOWNButton = uibutton(app.UIFigure, 'push');
app.DOWNButton.ButtonPushedFcn = createCallbackFcn(app,
@DOWNButtonPushed, true);
app.DOWNButton.Position = [283 39 100 22];
app.DOWNButton.Text = 'DOWN';
% Create RIGHTButton
app.RIGHTButton = uibutton(app.UIFigure, 'push');
app.RIGHTButton.ButtonPushedFcn = createCallbackFcn(app,
@RIGHTButtonPushed, true);
app.RIGHTButton.Position = [382 61 100 23];
app.RIGHTButton.Text = 'RIGHT';
% Create LEFTButton
app.LEFTButton = uibutton(app.UIFigure, 'push');
app.LEFTButton.ButtonPushedFcn = createCallbackFcn(app,
@LEFTButtonPushed, true);
app.LEFTButton.Position = [184 61 100 23];
app.LEFTButton.Text = 'LEFT';
% Create RESETButton
app.RESETButton = uibutton(app.UIFigure, 'push');
app.RESETButton.ButtonPushedFcn = createCallbackFcn(app,
@RESETButtonPushed, true);
app.RESETButton.Position = [514 143 100 23];
app.RESETButton.Text = 'RESET';
% Create QUITButton
app.QUITButton = uibutton(app.UIFigure, 'push');
app.QUITButton.ButtonPushedFcn = createCallbackFcn(app,
@QUITButtonPushed, true);
app.QUITButton.Position = [514 61 100 23];
app.QUITButton.Text = 'QUIT';
% Construct app
function app = Application4
if nargout == 0
clear app
end
end