⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmcxy.m

📁 精通Matlab综合辅导与指南 用于数学建模的教科书
💻 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 + -