Use the left mouse button to draw a polyline, and at the same time in the left mouse button point to output a string containing the location information, using the middle mouse button or right-click to terminate the drawing.
Solution: Create a untitled.m file
MATLAB directive:
Clf;axis ([0,10,0,5]); hold on
X=[];y=[];
for i=1:100
[X1,y1,button]=ginput (1);
chstr=[' (', Num2str (x1),', ', Num2str (y1),') '];text (x1, Y1,CHSTR);
X=[x,x1];y=[y,y1];line (x, y);
Pause (1);
if(button~=1); Break ; End
End
hold off
Results:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7D/E7/wKioL1byiHjwkQWVAACIENEIr6M302.png "title=" Picture 6.png "alt=" Wkiol1byihjwkqwvaacieneir6m302.png "/>
This article is from the "Rock Owl" blog, please be sure to keep this source http://yaoyaolx.blog.51cto.com/10732111/1754465
Draw a polyline with the left mouse button, and use the middle or right mouse button to stop drawing