addtag.m

来自「EMD方法的matlab实现」· M 代码 · 共 29 行

M
29
字号
%ADDTAG  add a tag to an object%% ADDTAG(OBJ_HANDLE,STR)% % Adds the tag STR to the object referrenced by OBJ_HANDLE% When OBJ_HANDLE is an array of handles, STR is added to all corresponding% objects.% % Rem: In order for this to work properly, the object's tag field must be a string % containing keywords (or tags) separated by commas.%%% See also%  hastag, findtag, rmtag%% G.Rilling 12/2006% gabriel.rilling@ens-lyon.frfunction addtag(obj,str)inds = ~hastag(obj,str);tags = get(obj(inds),'Tag');if ~iscell(tags)  tags = {tags};endinds = find(inds);new_tags = cellfun(@(x)[x,',',str],tags,'UniformOutput',false);new_tags = cellfun(@(x)regexprep(x,'^,',''),new_tags,'UniformOutput',false);arrayfun(@(ind)set(obj(inds(ind)),'Tag',new_tags{ind}),1:length(inds));

⌨️ 快捷键说明

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