?? mmcxy.m
字號:
function out=mmcxy(arg)%MMCXY Show x-y Coordinates Using Mouse.% MMCXY places the x-y coordinates of the mouse in the% lower left hand corner of the current 2-D figure window.% When the mouse is clicked, the coordinates are erased.% XY=MMCXY returns XY=[x,y] coordinates where mouse was clicked.% XY=MMCXY returns XY=[] if a key press was used.% D.C. Hanselman, University of Maine, Orono, ME, 04469% 3/30/95% Copyright (c) 1996 by Prentice-Hall, Inc.global MMCXY_OUTif ~nargin Hf=mmgcf; if isempty(Hf), error('No Figure Available.'),end Ha=findobj(Hf,'Type','axes'); if isempty(Ha), error('No Axes in Current Figure.'),end Hu=uicontrol(Hf,'Style','text',... 'units','pixels',... 'Position',[1 1 140 15],... 'HorizontalAlignment','left'); set(Hf, 'Pointer','crossh',... 'WindowButtonMotionFcn','mmcxy(''move'')',... 'WindowButtonDownFcn','mmcxy(''end'')',... 'Userdata',Hu) figure(Hf) % bring figure forward if nargout % must return x-y data key=waitforbuttonpress; % pause until mouse is pressed if key, out=[]; % return empty if aborted mmcxy('end') % clean things up else out=MMCXY_OUT; % now that move is complete return point end return endelseif strcmp(arg,'move') % mouse is moving in figure window cp=get(gca,'CurrentPoint'); % get current mouse position MMCXY_OUT=cp(1,1:2); xystr=sprintf('[%.3g, %.3g]',MMCXY_OUT); Hu=get(gcf,'Userdata'); set(Hu,'String',xystr) % put x-y coordinates in text boxelseif strcmp(arg,'end') % mouse click occurred, clean things up Hu=get(gcf,'Userdata'); delete(Hu) set(gcf,'Pointer','arrow',... 'WindowButtonMotionFcn','',... 'WindowButtonDownFcn','',... 'Userdata',[])end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -