How to use gplot function given a matrix?

5 次查看(过去 30 天)
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?

回答(1 个)

Mischa Kim
Mischa Kim 2014-9-23
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] .

类别

Help CenterFile Exchange 中查找有关 Sparse Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by