Plotting Graph from Struct
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Isaac Osei Agyemang
il 11 Ott 2018
Commentato: Isaac Osei Agyemang
il 11 Ott 2018
Please can someone help me plot a graph from the attached mat file.
0 Commenti
Risposta accettata
Guillaume
il 11 Ott 2018
Modificato: Guillaume
il 11 Ott 2018
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 Commenti
Guillaume
il 11 Ott 2018
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);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graph and Network Algorithms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!