# How to plot node numbers using matrix of nodes's coordinates?

7 Ansichten (letzte 30 Tage)
Vitaly am 18 Apr. 2013
Beantwortet: kyaw zaw am 8 Jul. 2017
Hi, my script plots a mesh grid using:
where 'adj' is the adjacency matrix and 'NC' is the matrix of nodes' coordinates. It works absolutely fine, except for the fact that it doesn't plot the nodes' numbers on the graph.
For example, for a grid like this:
3-6-9
| | |
2-5-8
| | |
1-4-7
I need nodes' numbers to be on the graph and the nodes coordinates matrix is given by:
NC =
0 0
0 h
0 H1
w 0
w h
w H1
W1 0
W1 h
W1 H1
Where h's and w's are user's inputs.
The script also provides the matrix of nodes numbers, which for this example looks like this:
A =
1 4 7
2 5 8
3 6 9
I believe it is possible to use the above matrices to plot the nodes' numbers, but I don't know how. Any ideas?
##### 2 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Marcos Rezk am 13 Mai 2016
how do you get the adjacency matrix

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Jonathan Epperl am 19 Apr. 2013
And text() doesn't give you the results you'd like? E.g.
k = 1:30;
[B,XY] = bucky;
gplot(B(k,k),XY(k,:),'-o')
axis square
for i=k
text(XY(i,1),XY(i,2),num2str(i,'%d'))
end
If that's not good enough, we could certainly do some cosmetics on it...
##### 1 KommentarKeine anzeigenKeine ausblenden
Vitaly am 19 Apr. 2013
That's perfect, thanks. I've modified it a little bit and got what I wanted.

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (2)

kyaw zaw am 8 Jul. 2017
Can We set locations of Nodes by coordination method? For example, Node1 is at x=3, y=4 of each axis. Please see following figure!In figure, all Nodes are located at wherever they want. We want to locate those Nodes systematically. Please answer is it possible or not!
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

kyaw zaw am 8 Jul. 2017
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by