www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@calibrationdata/@calibratable/setMemento.m
function setMemento(obj, s) %SETMEMENTO Restore state from a memento. % % SETMEMENTO(OBJ, S) restores the state of a calibratable object OBJ from a % MATLAB memento structure S. % % See also GETMEMENTO. % Copyright 2004-2005 The MathWorks, Inc. % Check class information if ~strcmp(class(obj), s.ClassName) error(message('mbc:calibrationdata:calibratable:LoadError')) end % Restore properties properties = fieldnames(s); properties(strcmp(properties, 'ClassName')) = []; % remove property ClassName for i = 1:length(properties), thisProperty = properties{i}; if strcmp(thisProperty, 'ReadOnly'), continue, end set(obj, thisProperty, s.(thisProperty)); end % Set ReadOnly last set(obj, 'ReadOnly', s.ReadOnly);