get
Query property values for audioplayer object
Syntax
Value = get(obj,Name)
Values = get(obj,{Name1,...,NameN})
Values = get(obj)
get(obj)
Description
returns the value of the specified property for object Value = get(obj,Name)obj.
returns the values of the specified properties in a 1-by-Values = get(obj,{Name1,...,NameN})N cell
array.
returns a scalar structure that contains the values of all properties
of Values = get(obj)obj. Each field name corresponds to
a property name.
get( displays
all property names and their current values.obj)
Examples
Create an audioplayer object from the example
file handel.mat and query the object properties:
load handel.mat;
handelObj = audioplayer(y, Fs);
% Display all properties.
get(handelObj)
% Display only the SampleRate property.
get(handelObj, 'SampleRate')
% Create a cell array that contains
% values for two properties.
info = get(handelObj, {'BitsPerSample', 'NumChannels'});Alternatives
To access a single property, you can use dot notation. Reference
each property as though it is a field of a structure array. For example,
find the value of the TotalSamples property for
an object named handelObj (as created in the Example):
numSamples = handelObj.TotalSamples;
This command is exactly equivalent to:
numSamples = get(handelObj, 'TotalSamples');