Main Content

cloneImpl

Class: matlab.System

Create duplicate System object

Syntax

objCloned = cloneImpl(obj)

Description

objCloned = cloneImpl(obj) specifies the algorithm that creates a duplicate of the System object™ obj. When you duplicate a System object the in-use status of the original object is inherited by the cloned object. Use isLocked to check if a System object is in use.

If cloneImpl is not defined the clone method creates a System object with same property and states as the original object.

Run-Time Details

cloneImpl is called by the clone method.

Method Authoring Tips

  • You must set Access = protected for this method.

  • In this method, cannot modify any properties of the original object.

  • Use this method to change the properties of an unlocked System object or change the states of a locked System object while duplicating.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your cloneImpl method does not use the object, you can replace this input with ~.

Output Arguments

expand all

Copy of the System object according to method specifications.

Examples

expand all

Specify in your class definition file that the System object state power is set to a desired value when the object is duplicated while it is in use.

methods (Access = protected)
   function objCloned = cloneImpl(obj)
           if isLocked(obj)
               objCloned = obj;
               objCloned.power = 1;
           else
               objCloned = obj;  
           end 
   end
end

Version History

Introduced in R2012b