File Exchange

image thumbnail

Demonstration of Astar (A*)

version (14.9 KB) by Bob Sturm
Pathfinding algorithm Astar (A*)


Updated 21 Feb 2011

View Version History

View License

How do you find the shortest path from one point to another in a computationally efficient way? The A* algorithm provides one implementation where the distance to the goal is considered as a heuristic in addition to local weightings, and the best path is recovered without combinatorial complexity.

Cite As

Bob Sturm (2020). Demonstration of Astar (A*) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

John McDowell

mj zhang

jimme shen

amin ta

replace wavread with audioread for matlab 2015b and after that

ehsan jeihani

it is great, but does not always find the shortest path

telema apaemi

wang chaoqun

Great demo!


Great!Very nice GUI ,workable function and readable code ! But in the program the variables appears to change its size all the time, and I think the reallocating of memory might costs a lot of time.(However , I'm new learner , my opinion may be incorrect~)

Cristian munoz

Carl Fischer

Nice demo. Thanks. However, I'm struggling to make the algorithm work with a rectangular map due to the fact that the order of the x and y axes depends on whether we're talking about image coordinates or matrix indexes. Terribly confusing.

David Buckingham

this is great. code is readable and the animation looks pretty. i wish there was a gui control to slow down the animation.

TheCount Graven

I was playing with the code and I think that the g part of the Astar equation (f=g+h) is missing. I inputted my own state space for the algorithm to traverse and it went 7 spaces more than it needed to to reach its goal. I added a crude form of g and it found the optimal path I was looking for in my example. Other than that I like this GUI it looks really nice.

Mike Russell

Love this, presentation is beautiful and code is quite readable.

Thanks for this tool!

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!