www.gusucode.com > mbclayouts 工具箱 matlab 源码程序 > mbclayouts/@xregcontainer/removeItem.m

    function  removeItem(obj, index)
%  Synopsis
%     function  removeItem(obj, index)
%
%  Description
%     Removes an item at index from the xregcontainer
%     and repacks the group
%
%  See Also
%     Methods xregcontainer

%  Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.




elements = obj.g.elements;

len = length(elements);
if index > len
   error(message('mbc:xregcontainer:InvalidIndex'));
end

delete(elements{index});
select = find((1:len)~=index);
elements = {elements{select}};

obj.g.elements= elements;