Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Handle Classes

Classes can support reference or value semantics.

Create the appropriate type of class for your application:

  • Value classes enable you to create new array classes that have the same semantics as numeric classes.

  • Handle classes define objects that reference the object. Copying an object creates another reference to the same object.

For a discussion of how object users work with handle objects, see Handle Object Behavior.

Functions

isequalDetermine array equality
eqDetermine equality

Classes

handleSuperclass of all handle classes
matlab.mixin.SetGetProvide handle classes with set and get methods
matlab.mixin.SetGetExactNamesRequire exact name match for set and get methods
dynamicpropsSuperclass for classes that support dynamic properties
matlab.mixin.CopyableSuperclass providing copy functionality for handle objects

Methods

handle.addlistenerCreate event listener bound to event source
handle.listenerCreate event listener without binding to event source
handle.notifyNotify listeners that event is occurring
handle.deleteDelete handle object
handle.findobjFind handle objects
handle.findpropFind meta.property object
handle.isvalidDetermine valid handles
handle.relationaloperatorsDetermine equality or sort handle objects

Topics

Characteristics of Handle and Value Classes

Comparison of Handle and Value Classes

Value objects are associated with a specific variable. Handle objects can be referenced by multiple variables.

Which Kind of Class to Use

Whether you implement a handle or value class depends on what your class represents and how you want objects to behave.

Handle Object Behavior

MATLAB® handle variables support reference semantics.

Building on the Handle Class

The Handle Superclass

The handle class implements methods to support events and listeners, destructors, relational operations, and other operations.

Handle Class Destructor

Define a delete method to customize what happens when MATLAB destroys handle objects.

Working with Handle Classes

Find Handle Objects and Properties

Find objects using regular expressions or obtain the meta.property object for specific properties.

Implement Set/Get Interface for Properties

Create a set/get interface for your handle class.

Implement Copy for Handle Classes

Customize object copy operations by deriving from the matlab.mixin.Copyable class.

Control Number of Instances

Limit the number of instances of a class that can exist using a singleton pattern.

Was this topic helpful?