Plotting Graph from Struct

1 次查看(过去 30 天)
Please can someone help me plot a graph from the attached mat file.

采纳的回答

Guillaume
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
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);
Isaac Osei Agyemang
Isaac Osei Agyemang 2018-10-11
Thanks, this the outcome I was expecting. Thanks Guillaume.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by