www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DetermineIndexOfNamedNodeExample.m
%% Determine Index of Named Node % Create a graph, and then determine the numeric node index for the nodes % named |'AB'| and |'BC'|. % Copyright 2015 The MathWorks, Inc. s = {'AA' 'AA' 'AA' 'AB' 'AC' 'BB'}; t = {'BA' 'BB' 'BC' 'BA' 'AB' 'BC'}; G = graph(s,t) %% % k = findnode(G,{'AB' 'BC'}) %% % |k| contains the row index into |G.Nodes.Name| for each specified node.