Hierarchy in MATLAB

Introduction to Hierarchy

This blog is part 2 on the object oriented programming in Matlab. Consider reading out previous blog first.

In classifying objects, hierarchy in the objects is a common occurrence, where subclasses and super-classes can be defined. In the example of a rectangle class, a superclass namely Shape can be defined, where the superclass provides a more broadly defined class for a shape, and rectangle a more narrowly defined class for a specific type of shape. We can extend our example, by including the creation of Triangle and Circle classes, which are also subclasses of the superclass Shape.

Continue reading

Demo: How to create objects using OOP in MATLAB in under 10 minutes!


In this post, a demonstration on how to create objects using object oriented programming (OOP) in MATLAB is covered using easy to follow steps, and the basic MATLAB syntax. The demo is structured as follows:

  • creating objects using the basic MATLAB syntax,
  • hierarchy in objects (including Abstract method functions), and
  • initialising and validating property values.

OOP is an approach to programming, where focus is put on design patterns and classification systems. It forms a consistent framework which is recognisable, and can be easily reused and extended by others. OOP is ideal to use when designing complex models, because of the flexibility and extensibility of the code, where a simple model can easily be extended to cover a more complex model. Continue reading