How to plot lines between points
Afficher commentaires plus anciens
I Have a matrix of routes (11x11)
1 5 46 1 0 0 0 0 0 0 0
1 41 10 40 73 13 27 1 0 0 0
1 31 75 49 30 16 58 14 28 53 1
1 68 36 20 55 9 47 35 1 0 0
1 7 34 24 57 64 1 0 0 0 0
1 4 45 25 50 17 52 1 0 0 0
1 59 11 32 26 56 19 51 33 18 1
1 2 44 42 43 65 23 62 22 29 1
1 48 37 70 72 61 71 21 38 6 1
1 76 69 3 63 74 1 0 0 0 0
1 39 12 66 67 60 15 54 8 1 0
This means that the vehicle will go from 1 to 5 to 46...and return to 1 again. There are 11 different routes.
I have plotted already
for i=1:N
pltx(i)=z(i,2)
plty(i)=z(i,3)
pltz(i)=z(i,1)
end
n=numel(pltx);
plot( graph(1:n,1:n),'LineStyle','none','Marker','d','XData',pltx,'YData',plty);

z(Nx3) is a matrix with the coordinates of each point.
Now i would like to plot a line that would follow the order in the matrix routes connecting the points with z coordinates.
The outcome im looking for is this: 

or something close. Any ideas on what else i would need to add to my code to make it work ?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations 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!
