|
|
: |3 a/ w6 h0 `function test_mouse_track()
: X* R9 F0 A( x6 p# gfigure;
4 B- E& y! _3 y$ l8 _4 n) Zaxis([-10,10,0,5]);0 D+ ~8 H4 D2 ?* W2 _
myfile = fullfile(tempdir,'position.mat');, ~: F) D% {" e4 p- [ v3 i
set(gcf,'WindowButtonDownFcn',@ButttonDownFcn);
; B+ S3 B& X! ^& H. B
5 h& h q4 o$ \7 n8 t
; m9 m; v* F" I7 |% 回调函数
/ d4 _8 u C9 O$ _1 ~, yfunction ButttonDownFcn(src,event)
& M+ b/ G! P) V; ^ ^( M. P% O: l6 a; Kpt = get(gca,'CurrentPoint');
, }; F* ~8 i- |( x; cx = pt(1,1);. H4 X! F9 z: }, ~
y = pt(1,2);
! `$ e5 s# }- Q8 Bsave('position.mat','pt','-ascii','-append');
. j# x- ]% } G7 m( gfprintf('x=%f,y=%f\n',x,y);
# s. E6 Y/ A5 ]& J4 j
1 T+ W3 B7 N' O: G产生的position.mat文件中就是坐标点数据。 |
|