www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@stack/removeItem.m
function removeItem( obj, ID ) %REMOVEITEM Remove an item from the stack % % obj.removeItem(ID) removes the item that returned ID when it was added. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. if ~isempty(ID) ItemIndex = find(obj.IDList==ID); if ~isempty(ItemIndex) % Shift the items above the removed one to the left and then blank out % the end stack item obj.ObjectList(ItemIndex:obj.nItems-1) = obj.ObjectList(ItemIndex+1:obj.nItems); obj.ObjectList(obj.nItems) = {[]}; obj.IDList(ItemIndex:obj.nItems-1) = obj.IDList(ItemIndex+1:obj.nItems); obj.IDList(obj.nItems) = -1; if ItemIndex==obj.nItems obj.nItems = obj.nItems-1; obj.send('TopItemChange', handle.EventData(obj, 'TopItemChange')); else obj.nItems = obj.nItems-1; end end end