Main Content

set

Set property values for audiorecorder object

Syntax

set(obj,Name,Value)
set(obj,cellOfNames,cellOfValues)
set(obj,structOfProperties)
settableProperties = set(obj)

Description

set(obj,Name,Value) sets the named property to the specified value for the object obj.

set(obj,cellOfNames,cellOfValues) sets the properties listed in the cell array cellOfNames to the corresponding values in the cell array cellOfValues. Each cell array must contain the same number of elements.

set(obj,structOfProperties) sets the properties identified by each field of the structure array structOfProperties to the values of the associated fields.

settableProperties = set(obj) returns the names of the properties that you can set in a structure array. The field names of settableProperties are the property names.

Examples

View the list of properties that you can set for an audiorecorder object:

recorderObj = audiorecorder;
set(recorderObj)

Set the Tag and UserData properties of an audiorecorder object using a structure array:

newValues.Tag = 'My Tag';
newValues.UserData = {'My User Data', pi, [1 2 3 4]};

recorderObj = audiorecorder;
set(recorderObj, newValues)

% View the values all properties.
get(recorderObj)

Tips

The set function allows combinations of property name/value pairs, cell array pairs, and structure arrays in the same function call.

Alternatives

To set the value of a single property, you can use dot notation. Reference each property as though it is a field of a structure array. For example, set the Tag property for an object called recorderObj (as created in the Examples):

recorderObj.Tag = 'This is my tag.';

This command is exactly equivalent to:

set(recorderObj, 'Tag', 'This is my tag.');

See Also

|