Plotting Graph from Struct
1 回表示 (過去 30 日間)
古いコメントを表示
Isaac Osei Agyemang
2018 年 10 月 11 日
コメント済み: Isaac Osei Agyemang
2018 年 10 月 11 日
Please can someone help me plot a graph from the attached mat file.
0 件のコメント
採用された回答
Guillaume
2018 年 10 月 11 日
編集済み: Guillaume
2018 年 10 月 11 日
We could have done with an explanation of what the fields of your structure actually represent.
Assuming that the field A is the adjacency matrix of your graph (you really should have told us that), then:
matcontent = load('dolphins.mat');
network = graph(matcontent.Problem.A, cellstr(matcontent.Problem.aux.nodename));
plot(network);
See the documentation of graph.plot for the various plotting options as the default plot is quite messy. In particular, you may want to play with the 'Layout' option.
edit: fixed typo in nodename
3 件のコメント
Guillaume
2018 年 10 月 11 日
It was an obvious typo of the name of one your variables which you should have spotted yourself:
network = graph(matcontent.Problem.A, cellstr(matcontent.Problem.aux.nodename));
plot(network);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graph and Network Algorithms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!