obj2mfile
Convert OPC object to MATLAB code
Syntax
obj2mfile(DAObj,'FileName')
obj2mfile(DAObj,'FileName','Syntax
')
obj2mfile(DAObj,'FileName','Mode
')
obj2mfile(DAObj,'FileName','Syntax
','Mode
')
Description
obj2mfile(DAObj,'FileName')
converts the
opcda
object DAObj
to the equivalent
MATLAB® code using the set
syntax and saves the MATLAB code to a file specified by FileName
. If an
extension is not specified, the .m
extension is used. Only those
properties that are not set to their default values are written to
FileName
.
obj2mfile(DAObj,'FileName','
converts the OPC object to the equivalent MATLAB code using the specified
Syntax
')'
Syntax
'
and
saves the code to the file, FileName
.
'
Syntax
'
can be
either 'set'
or 'dot'
. By default,
'set'
is used.
obj2mfile(DAObj,'FileName','
and Mode
')
obj2mfile(DAObj,'FileName','
save the equivalent MATLAB code for all properties if
Syntax
','Mode
')'
Mode
'
is
'all'
, and save only the properties that are not set to their
default values if
'
Mode
'
is
'modified'
. By default, 'modified'
is
used.
If DAObj
’s UserData
is not empty or if any
of the callback properties is set to a cell array of values or to a function handle,
the data stored in those properties is written to a MAT-file when the toolbox object
is converted and saved. The MAT-file has the same name as the file containing the
toolbox object code, but with a different extension.
The values of read-only properties will not be restored. For example, if an object
is saved with a Status
property value of
'connected'
, the object will be recreated with a
Status
property value of 'disconnected'
(the default value). You can use propinfo
to determine if a property is read-only.
To recreate DAObj
, type the name of the file that you
previously created with obj2mfile
.
Examples
Create a client with a group and an item, then save that client to disk:
da = opcda('localhost','Dummy.Server'); da.Tag = 'myopcTag'; da.Timeout = 300; grp = addgroup(da,'TestGroup'); itm = additem(grp,'Dummy.Tag1'); obj2mfile(da,'myopc.m','dot','all');
Recreate the client under a different name:
copyOfDA = myopc;
Version History
Introduced before R2006a