Skip to Main Content Skip to Search
Product Documentation

MATLAB Objects

Getting Oriented

This chapter provides information for people using objects. It does not provide a thorough treatment of object-oriented concepts, but instead focuses on what you need to know to use the objects provided with MATLAB.

If you are interested in object-oriented programming in the MATLAB language, see Object-Oriented Programming. For background information on objects, see object-oriented design.

Getting Comfortable with Objects

MATLAB uses objects because they are a convenient way to package data. Working with objects in MATLAB is like working with any variables and is often more convenient because objects are optimized for specific purposes. Think of an object as a neatly packaged collection of data that includes functions that operate on the data. The documentation for any particular object describes how to use it.

What Are Objects and Why Use Them?

In the simplest sense, objects are special-purpose variables that have a specific set of operations that you can perform on the data they contain. You do not need to know how the operations are implemented or how the data is stored. This makes objects modular and easy to pass within application programs. It also isolates your code from changes to the object's design and implementation.

In a more general sense, objects are organized collections of data and functions that have been designed for specific purposes. For example, an object might be designed to contain time series data that consists of value/time-sample pairs and associated information like units, sample uniformity, and so on. This object could have a set of specific operations designed to perform analysis, such as filtering, interpolating, and plotting. The following sections provide examples of such objects.

Accessing Objects

You access an object with its variable name. Interacting with objects variables in MATLAB software is really no different from interacting with any other variables. Basically, you can perform the same common operations on variables whether they hold numbers or specialized objects. For example, you can do the following things with objects:

Any object can have restrictions on how you create it, access its data, or what operations you can perform on it. Refer to the documentation for the particular MATLAB object for a description of what you can do with that object.

Objects In the MATLAB Language

The MATLAB language uses many specialized objects. For example, MException objects capture information when errors occur, timer objects execute code at a certain time interval, the serial object enables you to communicate with devices connected to your computer's serial port, and so on. MATLAB toolboxes often define objects to manage the specific data and analyses performed by the toolbox.

All of these objects are designed to provide specific functionality that is not as conveniently available from general purpose language components.

Other Kinds of Objects Used by MATLAB

The MATLAB language enables you to use other kinds of objects in your MATLAB programs. The following objects are different from the MATLAB objects described in this documentation. See the individual sections referenced below for information on using these objects.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS