Documentation

loadObjectImpl

Class: matlab.System
Package: matlab

Load saved 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 handle

Examples

expand all

Load System Object

Load a saved System object. In this case, the object contains a child object, protected and private properties, and a discrete state.

methods (Access = protected)
   function loadObjectImpl(obj, s, wasLocked)
      % Load child System objects
      obj.child = matlab.System.loadObject(s.child);

      % Save protected & private properties
      obj.protected = s.protected;
      obj.pdependentprop = s.pdependentprop;
      
      % Save state only if locked when saved
      if wasLocked
        obj.state = s.state;
      end

      % Call base class method
      loadObjectImpl@matlab.System(obj,s,wasLocked);
    end    
  end
Was this topic helpful?