loadObjectImpl

Load System object from MAT file

Syntax

loadObjectImpl(obj,s,wasInUse)

Description

loadObjectImpl(obj,s,wasInUse) implements the code to load a saved System object™ from a structure, s, or from a MAT file. If the object was in use when saved, the wasInUse input indicates whether the object was in use the states if the object was in use when saved. Your loadObjectImpl method should correspond to your saveObjectImpl method to ensure that all saved properties and data are loaded.

Note

You must set Access = protected for this method.

Input Arguments

obj

System object

Examples

expand all

Load a saved System object. In this example, the object contains a child object, protected and private properties, and a discrete state. It also loads states if the object is in use and calls the loadObjectImpl method from the matlab.System class.

methods (Access = protected)
  function loadObjectImpl(obj,s,wasInUse)
    obj.child = matlab.System.loadObject(s.child);
    
    obj.protectedprop = s.protectedprop;
    obj.pdependentprop = s.pdependentprop;
    
    if wasInUse
      obj.state = s.state;
    end
    
    loadObjectImpl@matlab.System(obj,s,wasInUse);
  end    
end
Was this topic helpful?