matlab ginput詳解


functions:Graphical input from mouse or cursor

ginput提供了一個十字光標使我們能更精確的選擇我們所需要的位置,並返回坐標值。函數調用形式為:

[x,y] = ginput(n)
[x,y] = ginput
[x,y,button] = ginput(...)

對於[x,y] =
ginput(n),能使你從當前的坐標系中讀取n個點,並返回這n個點的x,y坐標,均為nX1的向量。可以按回車提前結束讀數。


[x,y] = ginput 可以無限的讀取坐標直到按下回車鍵。

[x,y,button] = ginput(...)
返回x和y的坐標,以及button值(1=左鍵,2=中,3=右)或者按鍵的ASXII碼值。

Clicking an axes makes that axes the current axes. Even if you set the current axes before calling ginput, whichever axes you click becomes the current axes and ginput returns points relative to that axes. If you select points from multiple axes, the results returned are relative to the coordinate system of the axes they come from.

 

 

example:

 

>> [x,y,button] = ginput(1)

 

x =

 

    0.1118

 

y =

 

    0.6623

 

button =

 

     1

button返回次數,x,y分別返回的是鼠標所點的坐標。大家可以試試的 ,挺簡單的

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM