How to use gplot function given a matrix?
Afficher commentaires plus anciens
Hello everybody I want to take the following matrix and have MATLAB draw a network out of the data within the matrix. I'm almost certain I have to use the gplot function to do this, but I have an error. Here is what I have:
ptCoordMx = [ 2.85714 37.14286; 2.85714 11.42857; 17.14286 11.42857; 25.71429 17.14286; 34.28571 22.85714; 25.71429 5.71429; 34.28571 11.42857; 34.28571 0.00000; 42.85714 17.14286; 42.85714 05.71429; 51.42857 11.42857; 65.71429 11.42857; 65.71429 37.14286; ]
Coordinates = 1:1:100 gplot(ptCoordMx,Coordinates) //// I keep getting an error for this line
any ideas?
Réponses (1)
Mischa Kim
le 23 Sep 2014
Sharif, check out the example below
Cor = [2 2; 1 -1; -3 -3; -1 1];
A = [0 1 0 1;...
1 0 1 1;...
0 1 0 0;...
1 1 0 0];
gplot(A,Cor)
Cor are the coordinates of in this case of four different points. A is the so-called adjacency matrix that defines which points are interconnected (1) and which are not (0). For example the first point [2 2] is connected with the second [1 -1] and the fourth [-1 1]. The third point [-3 -3] is connected to the second point [1 -1] .
1 commentaire
lily yang
le 10 Avr 2017
thank you so much. I'm new to this and your answer helped me a lot.
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!