How to link two matrix, node's coordinate and lines between nodes?

1 次查看(过去 30 天)
I have imported two matrix from Gmsh into matlab.
One matrix (3x45) provides to me the coordinates of nodes, the second (2x136) provides to me the connections between nodes.
The problem is that I know that each number of the second matrix is a nodes but for matlab are just two matrix with randon number.
How can i say to matlab that each nodes are the coordinates storage in the first matrix?
Example:
the first row of Line matrix is 1 17 and I would like to code in matlab 1 and 17 correspond with first and 17th row of Nodes matrix
Nodes =
1 0 0 0
2 5 0 0
3 5 5 0
4 0 5 0
5 0.999999999998413 5 0
6 1.99999999999551 5 0
7 2.99999999999697 5 0
8 3.99999999999849 5 0
9 5 4.00000000000000 0
10 5 3.00000000000000 0
11 5 1.99999999999999 0
12 5 0.999999999999991 0
13 4.00000000000000 0 0
14 3.00000000000000 0 0
15 1.99999999999999 0 0
16 0.999999999999991 0 0
17 0 0.999999999998413 0
18 0 1.99999999999551 0
19 0 2.99999999999697 0
20 0 3.99999999999849 0
21 2.50000000000036 2.50000000000001 0
22 1.43749999999957 1.43750000000026 0
23 1.43750000000081 3.56250000000055 0
24 3.56250000000014 1.43749999999987 0
25 3.56250000000025 3.56249999999959 0
26 2.55163043478259 1.01967773437503 0
27 3.98032226562521 2.55163043478244 0
28 1.01967773437521 2.44836956521634 0
29 2.44836956521649 3.98032226562503 0
30 0.835416666666811 0.835416666666551 0
31 0.835416666666499 4.16458333333299 0
32 4.17768912837252 0.822310871627482 0
33 4.16458333333322 4.16458333333347 0
34 2.15172155753807 1.84171674372294 0
35 1.91602312080068 2.87764584152284 0
36 3.15726153869470 2.15517014158528 0
37 2.87711830552300 3.08476478749167 0
38 0.658518880208503 3.43509057970907 0
39 1.56490942028979 0.658518880208368 0
40 3.43509057970908 4.34148111979162 0
41 0.662502325148937 1.56031395574398 0
42 3.45836391263105 0.655897721200476 0
43 4.34410227879957 1.56228826128196 0
44 1.56031395574401 4.33749767485115 0
45 4.33749767485133 3.43968604425469 0
Lines=
1 17
1 30
2 13
2 32
3 9
3 33
4 5
4 31
5 6
5 31
5 44
6 7
6 29
6 44
7 8
7 29
7 40
8 3
8 33
8 40
9 10
9 33
9 45
10 11
10 27
10 45
11 12
11 27
11 43
12 2
12 32
12 43
13 14
13 32
13 42
14 15
14 26
14 42
15 16
15 26
15 39
16 1
16 30
16 39
17 18
17 30
17 41
18 19
18 28
18 41
19 20
19 28
19 38
20 4
20 31
20 38
21 34
21 35
21 36
21 37
22 26
22 28
22 30
22 34
22 39
22 41
23 28
23 29
23 31
23 35
23 38
23 44
24 26
24 27
24 32
24 36
24 42
24 43
25 27
25 29
25 33
25 37
25 40
25 45
26 15
26 22
26 24
26 34
26 36
26 39
26 42
27 11
27 24
27 25
27 36
27 37
27 43
27 45
28 19
28 22
28 23
28 34
28 35
28 38
28 41
29 7
29 23
29 25
29 35
29 37
29 40
29 44
30 17
30 22
30 39
30 41
31 5
31 23
31 38
31 44
32 13
32 24
32 42
32 43
33 9
33 25
33 40
33 45
34 21
34 28
34 35
34 36
35 29
35 37
36 21
36 37

回答(1 个)

Steven Lord
Steven Lord 2019-7-22
Make a graph or digraph (depending whether your network is undirected or directed) object. You can store your coordinates as custom attributes in the Nodes table of the graph or digraph then use that data as the XData, YData, and ZData when you plot it. See the "Custom Graph Node Coordinates" example on the plot documentation page for a demonstration of this technique.

类别

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