Upcoming Program

MATLAB & Simulink

Language and Programming

Object-Oriented Programming with MATLAB

Course Highlights

Attendees will learn to use object-oriented programming techniques to develop and maintain complex MATLAB® applications. In addition, ideas from a test-driven development approach to foster software quality and flexibility are introduced. Topics include:

  • Defining robust, intuitive, and reusable custom data types

  • Creating maintainable and extensible applications via inheritance and aggregation

  • Making applications reliable and flexible with unit tests

  • Enabling object synchronization using events and listeners

  • Creating and manipulating object arrays of distinct data types


MATLAB Programming Techniques or equivalent experience using MATLAB.

Course Outline

Day 1 of 2

Techsource Systems is
Mathworks Sole and Authorised Distributor and Training Partner

Creating Custom Data Types

Objective: Organize your files into packages. Learn some of the basic techniques and benefits of object-oriented programming and experience the differences between procedural and object-oriented programming.

  • Creating a namespace by storing multiple files in a package

  • Encapsulating data and functionality into a single class definition file

  • Documenting custom data types

  • Creating and using variables of custom data types


Designing a MATLAB Class

Objective: Make objects reliable by separating interface and implementation. Enhance code maintainability by avoiding code duplication. Customize standard operations for your classes.

  • Defining safe interactions via data access methods

  • Designing the public class interface with property and method attributes

  • Customizing standard operators for your class

  • Avoiding code duplication through internal refactoring


Building Class Hierarchies

Objective: Relate multiple similar classes via a common superclass. Extend the generic superclass by specializing its behavior in the subclasses.

  • Creating a superclass via abstraction

  • Inheriting from a superclass

  • Defining abstract properties and methods

  • Implementing specialized behavior in subclasses


Facilitating Multiple References

Objective: Embed one class into another via aggregation. Distinguish the use cases for pass-by-value vs. pass-by-reference behavior. Define a class that exhibits reference behavior.

  • Creating a viewer class containing a data class

  • Writing context-sensitive (polymorphic) code

  • Referencing one data object from multiple viewer objects

  • Choosing between handle and value classes

Day 2 of 2

Writing Unit Tests

Objective: Guarantee correct behavior by writing formal tests for the corresponding unit of code. Use the unit-testing framework provided within MATLAB. Enhance the quality and flexibility of your software.

  • Overview of the MATLAB unit testing framework

  • Writing a test method

  • Creating a test environment using setup and teardown methods

  • Parameterizing a test method

  • Aggregating and running suites of tests

  • Logging test and coverage results


Synchronizing Objects

Objective: Automatically react to property changes using predefined events, listeners, and callbacks. Trigger function calls based on custom events.

  • Events, listeners, and callbacks

  • Using predefined property events

  • Querying class meta information

  • Defining property listeners

  • Implementing a callback function

  • Defining custom events and their callbacks


Converting and Concatenating Objects

Objective: Implement data type conversions. Define precedence relationships between classes. Construct heterogeneous object arrays.

  • MATLAB operator precedence rules

  • Converting objects from one class to another

  • Defining a hierarchy of heterogeneous classes

  • Implementing methods for heterogeneous arrays