From 53270692e9afb4273a32f9665afabe3b22601e37 Mon Sep 17 00:00:00 2001 From: Cx330 <1487537121@qq.com> Date: Mon, 2 Jun 2025 19:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9A*=E7=9A=84=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Astar/Astar.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Astar/Astar.m b/Astar/Astar.m index a3fb10f..59da25e 100644 --- a/Astar/Astar.m +++ b/Astar/Astar.m @@ -61,5 +61,13 @@ while ~isequal(node(4:5),initial) path=[node(4:5); path]; node=closed(BinA(closed(:,1:2),node(4:5)),:); end -path +% 打印路径 + if ~isempty(path) + disp('路径为:'); + for i = 1:size(path, 1) + fprintf('(%d, %d)\n', path(i, 2), path(i, 1)); + end + else + disp('未找到路径。'); + end end \ No newline at end of file