Optimization_Toolbox使用问题

19 vues (au cours des 30 derniers jours)
蒙恩
蒙恩 le 28 Avr 2025
Commenté : 蒙恩 le 28 Avr 2025
显示已经成功安装了Optimization_Toolbox工具箱和全局Optimization_Toolbox工具箱,但是在调用graphallshortestpaths时出现如下报错:“函数或变量 'graphallshortestpaths' 无法识别。”在命令行中输入“>> which graphallshortestpaths"显示“未找到 'graphallshortestpaths'。”

Réponses (2)

Sam Chak
Sam Chak le 28 Avr 2025
Modifié(e) : Sam Chak le 28 Avr 2025
This graphallshortestpaths command has been removed since R2022b.
  1 commentaire
蒙恩
蒙恩 le 28 Avr 2025
感谢您的评论

Connectez-vous pour commenter.


Sam Chak
Sam Chak le 28 Avr 2025
You can use the distances() function as the alternative.
W = [.41 .99 .51 .32 .15 .45 .38 .32 .36 .29 .21];
DG = sparse([6 1 2 2 3 4 4 5 5 6 1],[2 6 3 5 4 1 6 3 4 3 5], W);
G = digraph(DG);
plot(G)
d = distances(G)
d = 6×6
0 1.3600 0.5300 0.5700 0.2100 0.9500 1.1100 0 0.5100 0.6600 0.3200 1.0400 0.6000 0.9400 0 0.1500 0.8100 0.5300 0.4500 0.7900 0.6700 0 0.6600 0.3800 0.8100 1.1500 0.3200 0.3600 0 0.7400 0.8900 0.4100 0.2900 0.4400 0.7300 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Compare result with graphallshortestpaths:

Catégories

En savoir plus sur Language Support dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by