Sample Class Implementations

MATLAB® classes showing programming patterns and techniques

Understand different workflows and approaches to class design and implementation.

MATLAB Language Syntax

classdefClass definition keywords

Topics

Create a Simple Class

This simple class introduces the basic patterns and syntax for defining a class.

Developing Classes — Typical Workflow

Classes implement your object-oriented design.

Representing Structured Data with Classes

Classes enable you to define specialized data structures.

Implementing Linked Lists with Classes

MATLAB handle objects enable you to implement an efficient linked-list data structure.

Representing Hardware with Classes

This example of a class derived from a built-in numeric class inherits useful behaviors.

Representing Polynomials with Classes

MATLAB enables you to define new data types using classes.

A Class Hierarchy for Heterogeneous Arrays

Heterogeneous class hierarchies enable you to form arrays of different, but related classes.

Static Data

Static data refers to data that all objects of the class share and that you can modify after creation. MATLAB supports techniques for working with static data.