Main Content

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


Creating a Simple Class

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

Using a Class to Display Graphics

This example of a MATLAB class definition shows syntax and programming techniques used in typical classes.

Developing Classes That Work Together

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.

Customize Parentheses Indexing for Mapping Class

This example shows how to customize parentheses indexing for a mapping class.

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.