
軸上でマウスをクリックし、座標点を表示させるにはどうすればよいですか?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 25 Okt. 2013
Beantwortet: MathWorks Support Team
am 25 Okt. 2013
GUIDE で作成した Figure において、軸上でマウスをクリックし、座標点を表示させる方法を教えてください。
Akzeptierte Antwort
MathWorks Support Team
am 25 Okt. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu アニメーション finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!