A fundamental purpose of objects is to contain data and facilitate ways to manipulate that data. Objects often define their own version of ordinary MATLAB® functions that work with the object. For example, you can create a
timeseries object and pass the object to
ts = timeseries(rand(100,1),.01:.01:1,'Name','Data1'); plot(ts)
However, MATLAB does not call the standard
plot function. MATLAB calls the
plot method, which can extract the data from the
timeseries object and create a customized graph.
Suppose that you use an
audioplayer object to play audio with MATLAB. To play audio, load audio data into MATLAB and create an
load('handel','Fs','y') chorus = audioplayer(y,Fs);
audioplayer function creates an object that you access using the object variable
chorus. MATLAB stores the audio source and other information in the object properties.
Here are the properties and values for the
chorus instance of the
Click the link to get the documentation on
The object’s documentation discusses the purpose of the object and describes the properties and methods that you use when working with objects of that class.
You can also list the methods to see what operations you can perform. Pass the object to the
methods function to see the list:
Methods for class audioplayer: audioplayer getdisp pause resume stop delete horzcat play set vertcat get isplaying playblocking setdisp
To play the audio, use the
These functions provide logical tests, which are useful when using objects in ordinary functions.
Determine whether an argument is an object of specific class.
Determine if two objects are equal, which means both objects are of the same class and size and their corresponding property values are equal.
|a == b (|
Determine if handle variable
Determine whether input is a MATLAB object
These functions provide information about object class components.