www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@data/BeginEdit.m
function D = BeginEdit(D) %BEGINEDIT Indicate that a data object should begin an editing session. % % D = BEGINEDIT(D) % % See also mbcmodel.data.CommitEdit, mbcmodel.data.RollbackEdit. % Copyright 2004-2005 The MathWorks, Inc. % Is the data object capable of being edited if ~D.IsEditable error('mbc:mbcmodel:data:InvalidState', 'A data object must originate from an editable source to begin an edit session'); end % Is this object already being edited - no need to do anything if D.IsBeingEdited return end % Make a copy of the data (see mdevproject/sendObjectToDataEditor) obj = copy(D.Object); % Make sure all the caches are up-to-date obj = restoreCachedInfo(obj); % Indicate that this object is now being edited and hence treats the % .Object field differently, using the local field not the heap copy D.IsBeingEdited = true; % Put the data copy back into the .Object field D.Object = obj;