Here is an implementation for the Star algorithm to solve a maze that is a 10 x 10 matrix in MATLAB using App Designer:
appdesigner
in the MATLAB command windowuiaxes
component onto the app designer canvasTag
property of the uiaxes
component to mazeAxes
uipanel
component onto the app designer canvasTitle
property of the uipanel
component to Actions
pushbutton
components onto the uipanel
Text
property of the first pushbutton
to Generate Maze
Text
property of the second pushbutton
to Solve Maze
Position
property of the Generate Maze
button to [20 10 100 22]
(adjust the values as per your preference)Position
property of the Solve Maze
button to [140 10 100 22]
(adjust the values as per your preference)uitable
component onto the app designer canvasTag
property of the uitable
component to mazeTable
Position
property of the uitable
component to [20 40 220 220]
(adjust the values as per your preference)*.mlapp
file in the MATLAB editorButtonPushed
callback of the Generate Maze
button:main.m262 chars11 lines
ButtonPushed
callback of the Solve Maze
button:main.m870 chars28 lines
main.m1112 chars36 lines
That's it! You should now be able to run the app and generate a random maze, and then solve it using the Star algorithm. The algorithm will display the number of nodes expanded and highlight the path in the maze table.
gistlibby LogSnag