Undefined function 'shortestPath' for input arguments of type 'double'.

Every time i use
>> [ending_pts ind] = solveTSP( ending_pts, true );
an error message appears:
Undefined function 'shortestPath' for input arguments of type 'double'.line 20
here is the code that give the message error:
% plot the shortest path
xd=[];yd=[];
for i = 1:(N_cities+1)
xd(i)=ending_pts(shortestPath(i),1);
yd(i)=ending_pts(shortestPath(i),2);
end
line(xd,yd);
title(['Path length = ',num2str(shortestPathLength)]);
hold off;
Any suggestions?
Thanks!

 採用された回答

Mahdi
Mahdi 2014 年 5 月 23 日

0 投票

You don't have the matrix (I assume) shortestPath or N_cities defined anywhere in your code. So it's either a global variable or you just missed it.
In this case, I'm assuming that shortestPath is a matrix containing the shortest distances between the cities.

2 件のコメント

mika
mika 2014 年 5 月 23 日
thank you for you fast reply
Mahdi
Mahdi 2014 年 5 月 23 日
No problem :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraph and Network Algorithms についてさらに検索

質問済み:

2014 年 5 月 23 日

コメント済み:

2014 年 5 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by