copy
Syntax
copiedTrafficModel = copy(trafficModel)
Description
copies a traffic model object of a subclass of the copiedTrafficModel = copy(trafficModel)wnet.Traffic class ,
trafficModel and returns the copied traffic model object,
copiedTrafficModel. The wnet.Traffic class
inherits the copy method from matlab.mixin.Copyable. The copy method enables you to create copies of objects of
subclasses derived from the wnet.Traffic base class.
The copy method follows these rules:
The method creates a new handle object. Modifying the original object does not affect the copied object.
The method retains the default copy behavior of
matlab.mixin.Copyable:The method performs a shallow copy of all non-dependent properties.
The method does not invoke the constructor or any set methods when copying objects.
If your custom traffic object reads data from a file using a file identifier, avoid initializing the identifier within the constructor. Doing so causes any copied objects to share the file identifier with the original object, because the
copymethod does not invoke the constructor.
Input Arguments
Examples
For an example of the use of copy, see Implement Copy for Handle Classes.
Version History
Introduced in R2026a