Problem with assigning node names to a directed graph

8 ビュー (過去 30 日間)
Emanuele Giacomuzzo
Emanuele Giacomuzzo 2020 年 11 月 20 日
回答済み: Emanuele Giacomuzzo 2020 年 11 月 20 日
I'm trying to add the node names to a directed graph. I used the following code:
load network.mat network;
load node_names.mat node_names;
graph=digraph(network,node_names,'omitselfloops');
network is the adjacency matrix (63x63 double) and node_names is the array with the node names (63x1 cell).
Now, when I try to create the graph with the node names, matlab tells me:
Error using digraph>validateFlag (line 643). Option must be 'omitselfloops'.
Error in digraph (line 253) omitLoops = validateFlag(nnames, omitLoops);
I have no idea what's wrong with my code.

採用された回答

Emanuele Giacomuzzo
Emanuele Giacomuzzo 2020 年 11 月 20 日
I solved it! I don't know why it didn't work before, but I used the following code:
graph.Nodes = node_names

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by