obj2mfile
Convert video input objects to MATLAB code
Syntax
obj2mfile(obj,filename)
obj2mfile(obj,filename,syntax
)
obj2mfile(obj,filename,syntax
,mode
)
obj2mfile(obj,filename,syntax
,mode
,reuse
)
Description
obj2mfile(obj,filename)
converts the video input
object obj
into an M-file with the name specified by
filename
. The M-file contains the MATLAB® code required to create the object and set its properties.
obj
can be a single video input object or an array of objects.
The obj2mfile
function simplifies the process
of restoring an object with specific property settings and can be
used to create video input objects. obj2mfile
also
creates and configures the video source object associated with the
video input object.
If filename
does not specify an extension or if it has an extension other
than the MATLAB M-file extension (.m
), obj2mfile
appends
.m
to the end of filename
. To recreate
obj
, execute the M-file by calling filename
.
If the UserData
property of the object is
set, or if any of the callback properties is set to a cell array or
to a function handle, obj2mfile
writes the data
stored in those properties to a MAT-file. obj2mfile
gives
the MAT-file the same name as the M-file, but uses the .mat
filename
extension. obj2mfile
creates the MAT-file in the
same directory as the M-file.
Note
obj2mfile
does not restore the values of
read-only properties. For example, if an object is saved with a Logging
property
set to 'on'
, the object is recreated with a Logging
property
set to 'off'
(the default value). Use the propinfo
function
to determine if a property is read only.
obj2mfile(obj,filename,
converts syntax
)obj
to the equivalent MATLAB code where syntax
specifies how
obj2mfile
assigns values to properties of the object.
syntax
can be either of the following character vectors. The default
value is enclosed in braces ({}).
Character Vector | Description |
---|---|
|
|
|
|
obj2mfile(obj,filename,
converts syntax
,mode
)obj
to the equivalent MATLAB code where mode
specifies which properties are configured.
mode
can be either of the following character vectors. The default
value is enclosed in braces ({}).
Character Vector | Description |
---|---|
| Configure writable properties that are not set to their default values. |
| Configure all writable properties. |
Note that obj2mfile(obj,filename,
mode
)
is a valid syntax. If the syntax
argument
is not specified, obj2mfile
uses the default value.
obj2mfile(obj,filename,
converts syntax
,mode
,reuse
)obj
to the equivalent MATLAB code where reuse
specifies whether
obj2mfile
searches for a reusable video input object or creates a new
one. reuse
can be either of the following character vectors. The
default value is enclosed in braces ({}).
Character Vector | Description |
---|---|
|
|
| Create a new object regardless of whether there are reusable objects. |
Note that obj2mfile(obj,filename,
reuse
)
is a valid syntax. If the syntax
and mode
arguments
are not specified, obj2mfile
uses their default
values.
Examples
Create a video input object.
vidobj = videoinput('winvideo', 1, 'RGB24_640x480');
Configure several properties of the video input object.
vidobj.FramesPerTrigger = 100; vidobj.FrameGrabInterval = 2; vidobj.Tag = 'CAM1';
Retrieve the selected video source object associated with the video input object.
src = getselectedsource(vidobj);
Configure the properties of the video source object.
src.Contrast = 85; src.Saturation = 125;
Save the video input object.
obj2mfile(vidobj, 'myvidobj.m', 'set', 'modified');
Delete the object and clear it from the workspace.
delete(vidobj); clear vidobj;
Execute the M-file to recreate the object. Note that obj2mfile
creates
and configures the associated video source object as well.
vidObj = myvidobj;
Version History
Introduced before R2006a
See Also
getselectedsource
| imaqhelp
| propinfo
| set
| videoinput