主要内容

copy

Copy mobility model

Since R2026a

Syntax

mobilityModelCopy = copy(mobilityModel)

Description

mobilityModelCopy = copy(mobilityModel) copies a mobility model object of a subclass of the wnet.Mobility class, mobilityModel and returns the copied mobility model object, mobilityModelCopy. The wnet.Mobility 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.Mobility 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 mobility object reads data from a file using a file identifier, do not initialize the identifier inside the constructor. If you do so and create a copy of your object, the copied object retains the same identifier as the original, since the copy method does not invoke the constructor.

Input Arguments

expand all

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

Output Arguments

expand all

Copied mobility model, returned as an object of a subclass of wnet.Mobility.

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