Documentation

loadObjectImpl

Class: matlab.System
Package: matlab

Load System object from MAT file

Syntax

loadObjectImpl(obj)

Description

loadObjectImpl(obj) loads a saved System object™, obj, from a MAT file. 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

collapse all

Load System object

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

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