mmzap.m

来自「matlab7.0这本书的源代码」· M 代码 · 共 37 行

M
37
字号
function mmzap(arg)
%MMZAP Delete Graphics Object Using Mouse. (MM)
% MMZAP waits for a mouse click on an object in
% a figure window and deletes the object.
% MMZAP or MMZAP text erases text objects.
% MMZAP axes  erases axes objects.
% MMZAP line  erases line objects.
% MMZAP surf  erases surface objects.
% MMZAP patch  erases patch objects.
%
% Clicking on an object other than the selected type, or striking
% a key on the keyboard aborts the command.

% D.C. Hanselman, University of Maine, Orono, ME, 04469
% 3/29/95, v5: 1/14/97
% Mastering MATLAB 5, Prentice Hall, ISBN 0-13-858366-8

if nargin<1, arg='text'; end

Hf=get(0,'CurrentFigure');
if isempty(Hf)
   error('No Figure Window Exists.')
end
if length(findobj(0,'Type','figure'))==1
	figure(Hf) % bring only figure forward
end
key=waitforbuttonpress;
if key  % key on keyboard pressed
	return
else    % object selected
	object=gco;
	type=get(object,'Type');
	if strncmp(type,arg,4)
		delete(object)
	end
end

⌨️ 快捷键说明

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