Save and Load Objects

Using the save command, you can save an OPC Toolbox™ Data Access object to a MAT-file, just as you would any workspace variable. This example saves the dagroup object grp to the MAT-file myopc.mat.

save myopc grp

When you save a toolbox object, all the toolbox objects in that object hierarchy are also saved. For example, if you save a dagroup object, the client, all groups associated with that client and all items created in those groups are saved along with the dagroup object. However, only those objects you elect to save will be created in the MATLAB® workspace. Other objects will be created with no reference to them in the workspace. To obtain a reference to an existing OPC Toolbox Data Access object, use the opcfind function.

To load a toolbox object that was saved to a MAT-file into the MATLAB workspace, use the load command. For example, to load grp from MAT-file myopc.mat, use

load myopc

    Note   The values of read-only properties are not saved. When you load a toolbox object into the MATLAB workspace, read-only properties revert back to their default values. To determine if a property is read-only, use the propinfo function.

Was this topic helpful?