Documentation Center

  • Trial Software
  • Product Updates

set

Class: VideoReader

Set property values for video reader 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.

Tips

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

Examples

expand all

View Settable Properties

View the list of properties that you can set for a video reader object.

xyloObj = VideoReader('xylophone.mp4');
set(xyloObj)
  General Settings:
    Tag
    UserData

Set Object Properties

Set the Tag and UserData properties of a video reader object using a structure array.

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

xyloObj = VideoReader('xylophone.mp4');
set(xyloObj, newValues)

View the values all properties.

get(xyloObj)
  General Settings:
    Duration = 4.7000
    Name = xylophone.mp4
    Path = matlabroot\toolbox\matlab\audiovideo
    Tag = My Tag
    Type = VideoReader
    UserData = {'My User Data'  [3.1416]  [1 2 3 4]}

  Video Settings:
    BitsPerPixel = 24
    FrameRate = 30
    Height = 240
    NumberOfFrames = 141
    VideoFormat = RGB24
    Width = 320

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 a reader object called xyloObj (as created in the Examples):

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

This command is exactly equivalent to:

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

See Also

|

Was this topic helpful?