メインコンテンツ

copy

Copy traffic model

Since R2026a

Syntax

copiedTrafficModel = copy(trafficModel)

Description

copiedTrafficModel = copy(trafficModel) copies a traffic model object of a subclass of the 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 copy method does not invoke the constructor.

Input Arguments

expand all

Traffic model to be copied, specified as an object of a subclass of wnet.Traffic.

Attributes

Sealedtrue

To learn about attributes of methods, see Method Attributes.

Examples

For an example of the use of copy, see Implement Copy for Handle Classes.

Version History

Introduced in R2026a