prcursor.m

来自「模式识别工具箱。非常丰富的底层函数和常见的统计识别工具」· M 代码 · 共 41 行

M
41
字号
%PRCURSOR Show object ident.%%    PRCURSOR(H)%% Enable the datacursor in a scatterplot. This can be used to% investigate the object identifier by clicking on the object.% Copyright: D.M.J. Tax, D.M.J.Tax@prtools.org% Faculty EWI, Delft University of Technology% P.O. Box 5031, 2600 GA Delft, The Netherlandsfunction out = prcursor(h,event_obj)% This file has to tasks: % 1. to setup the datacursor (by enabling it and setting the callback% function)% 2. to provide the callback when a user pressed on an objectif ~exist('datacursormode','file')	error('MATLAB 7.0 or newer is required (datacursormode.m is not available).');endif nargin ~=2	% we are doing the setup:	if nargin<1		h = gcf;	end	dh = datacursormode(h);	set(dh,'enable','on','updatefcn',@prcursor);else	% we are doing the callback:	nr = get(event_obj,'dataindex');	ud = get(get(event_obj,'target'),'UserData');	if ~isempty(ud) & isfield(ud,'ident')		nr = ud.ident(nr);	end	out = sprintf('obj. %d',nr);endreturn

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?