I'm doing a Dijkstra's Algorithm - Matlab Formulation. But when I run the code, it appears this error:
Unrecognized function or variable 'lenght'.
Error in dijkstra (line 5)
N = lenght(map);
Error in practice (line 2)
distances = dijkstra(map,1)
And I don't know why. It's worth mentioning that I have two windows or scripts, one where is my code and the definition of the functions, and the other one where I declare my data.
function distances = dijkstra(map,startingpoint)
distances(startingpoint) = 0;
candidates(index) = distances(index);
[currentDistance, currentPoint] = min(candidates);
newDistance = currentDistance + map(currentPoint, index);
if newDistance < distances(index)
distances(index) = newDistance;
visited(currentPoint) = 1;
map = xlsread('map.xlsx');
distances = dijkstra(map,1)