plot_route.m

来自「best routing protocol」· M 代码 · 共 24 行

M
24
字号
function plot_route(node_coord, route_path, color, draw_text)%visualize the  routing path draw_text = 1;if size(node_coord,2)~=2  error('wrong format in node_coord');endn = size(node_coord,1);hold onfrom = route_path(1);for i = 2:length(route_path)  to = route_path(i);  plot([node_coord(from,1) node_coord(to,1)], [node_coord(from,2), ...		    node_coord(to,2)],color);  if draw_text    idstr = sprintf('%d',from);    text(node_coord(from,1),node_coord(from,2),idstr);  end  from = to;endif draw_text  idstr = sprintf('%d',from);  text(node_coord(from,1),node_coord(from,2),idstr);end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?