| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
| On this page… |
|---|
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.
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:
Create it and assigned a variable name so you can reference it again
Assign or reassign data to it (see Accessing Object Data)
Operate on its data (see Calling Object Methods)
Convert it to another class (if this operation is supported by the object's class)
Save it to a MAT-file so you can reload it later (see save)
Copy it (see Copying Objects)
Clear it from the workspace (clear)
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.
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.
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.
Handle Graphics® objects represent objects used to create graphs and GUIs. These objects provide a set/get interface to property values, but are not extensible by subclassing. See Handle Graphics Objects for more information.
Sun Java objects can be used in MATLAB code enabling you to access the capabilities of Java classes. See Using Sun Java Classes in MATLAB Software for more information.
Microsoft COM objects enable you to integrate these software components into your application. See COM Support for MATLAB Software for more information.
Microsoft .NET objects enable you to integrate .NET assemblies into your application. See MATLAB Interface to .NET Framework for more information.
User-defined MATLAB objects created prior to Version 7.6 used different syntax for class definition (no classdef block) and exhibit other differences. See Compatibility with Previous Versions for more information.
![]() | Using Objects | General Purpose Vs. Specialized Arrays | ![]() |

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 |