Optimization_Toolbox使用问题

19 次查看(过去 30 天)
蒙恩
蒙恩 2025-4-28
评论: 蒙恩 2025-4-28
显示已经成功安装了Optimization_Toolbox工具箱和全局Optimization_Toolbox工具箱,但是在调用graphallshortestpaths时出现如下报错:“函数或变量 'graphallshortestpaths' 无法识别。”在命令行中输入“>> which graphallshortestpaths"显示“未找到 'graphallshortestpaths'。”

回答(2 个)

Sam Chak
Sam Chak 2025-4-28
编辑:Sam Chak 2025-4-28
This graphallshortestpaths command has been removed since R2022b.

Sam Chak
Sam Chak 2025-4-28
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:

类别

Help CenterFile Exchange 中查找有关 Language Support 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by