
軸上でマウスをクリックし、座標点を表示させるにはどうすればよいですか?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 25 Oct 2013
Réponse apportée : MathWorks Support Team
le 25 Oct 2013
GUIDE で作成した Figure において、軸上でマウスをクリックし、座標点を表示させる方法を教えてください。
Réponse acceptée
MathWorks Support Team
le 25 Oct 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur アニメーション dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!