This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Query property values for audioplayer object


Value = get(obj,Name)
Values = get(obj,{Name1,...,NameN})
Values = get(obj)


Value = get(obj,Name) returns the value of the specified property for object obj.

Values = get(obj,{Name1,...,NameN}) returns the values of the specified properties in a 1-by-N cell array.

Values = get(obj) returns a scalar structure that contains the values of all properties of obj. Each field name corresponds to a property name.

get(obj) displays all property names and their current values.


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.

% Display only the SampleRate property.
get(handelObj, 'SampleRate')

% Create a cell array that contains
% values for two properties.
info = get(handelObj, {'BitsPerSample', 'NumChannels'});


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');

See Also