Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

MATLAB Objects

What Are Objects?

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.

In the simplest sense, objects are special-purpose variables. Objects differ from general-purpose variables in that they define the operations you can perform on the data they contain. These operations create an interface with which you interact with the object, without needing to know how operations are implemented or how 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 that is relevant to this particular type of data. 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 particular object might 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.

See Variables for a general discussion of MATLAB variables.

Objects In the MATLAB Language

The MATLAB language uses many specialized objects. For example, timer objects execute code at a certain time interval, MException objects capture information when errors occur, 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-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS