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 VideoReader object.

xyloObj = VideoReader('xylophone.mp4');
set(xyloObj)
            Tag: {}
       UserData: {}
    CurrentTime: {}

Set Object Properties

Set the Tag and UserData properties of a VideoReader 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)
obj = 

  VideoReader with properties:

   General Properties:
           Name: 'xylophone.mp4'
           Path: 'matlabroot\toolbox\matlab\audiovideo'
       Duration: 4.7000
    CurrentTime: 0
            Tag: 'My Tag'
       UserData: {'My User Data'  [3.1416]  [1 2 3 4]}

   Video Properties:
           Width: 320
          Height: 240
       FrameRate: 30
    BitsPerPixel: 24
     VideoFormat: 'RGB24'

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?