
軸上でマウスをクリックし、座標点を表示させるにはどうすればよいですか?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 25 Ott 2013
Risposto: MathWorks Support Team
il 25 Ott 2013
GUIDE で作成した Figure において、軸上でマウスをクリックし、座標点を表示させる方法を教えてください。
Risposta accettata
MathWorks Support Team
il 25 Ott 2013
Figure の WindowButtonDownFcnコールバックに下記を定義します。
Axes の 'CurrentPoint' プロパティでは、Axes の単位に基づいたカレントのマウス位置を取得することができます。
これにより、クリックした点を取得することが可能です。
% handles.axes1: Axesのハンドル
pos = get(handles.axes1,'CurrentPoint')
pos(1,1) % x座標
pos(1,2) % y座標
なお、'CurrentPoint' で得られる行列は、次の要素を含みます。
pos =
[ xfront, yfront, zfront;
xback, yback,zback]
2次元座標の場合、行列の 1 行目、2行目の値は一致しますが、3 次元の座標軸の場合、行列の 1 行目は、前面の座標面に対する位置、2行目は、背面の座標面に対する位置を示します。

0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su アニメーション in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!