필터 지우기
필터 지우기

Plotting Graph from Struct

조회 수: 5 (최근 30일)
Isaac Osei Agyemang
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.

채택된 답변

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