Array indices must be positive integers or logical values.

1 回表示 (過去 30 日間)
Baihui Liao
Baihui Liao 2021 年 5 月 21 日
コメント済み: Baihui Liao 2021 年 5 月 21 日
Background: Write the function SPP of the shortest path problem from starting point 1 to end point n, based on Dijkstra's idea of shortest path
n: the number of nodes, the node number is 1,2... ,n
t is the matrix where t(I,j) represents the distance from node I to the directly connected edges of node j. If there is no directly connected edge from I to j, then T of I,j is equal to Inf of infinity.
and when I write:
f(i)=min{f(j)+tij};
It shows an error: "Array indices must be positive integers or logical values."

採用された回答

VBBV
VBBV 2021 年 5 月 21 日
%if true
f(i)=min{f(j)+t(i,j)};
  1 件のコメント
Baihui Liao
Baihui Liao 2021 年 5 月 21 日
thank you for your timely help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDijkstra algorithm についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by