Main Content

Saving Image Acquisition Objects

Using the save Command

You can save a video input object to a MAT-file just as you would any workspace variable by using the save command. This example saves the video input object vid to the MAT-file myvid.mat.

save myvid vid

When you save a video input object, all the video source objects associated with the video input object are also saved.

To load an image acquisition object that was saved to a MAT-file into the MATLAB® workspace, use the load command. For example, to load vid from MAT-file myvid.mat, use

load myvid

Note

The values of read-only properties are not saved. When you load an image acquisition object into the MATLAB workspace, read-only properties revert to their default values. To determine if a property is read only, use the propinfo function or read the property reference page.

Using the obj2mfile Command

Another way to save a video input object is to create an M-file that contains the set of commands used to create the video input object and configure its properties. You can use the obj2mfile function to create such an M-file. When you execute the M-file, it can create a new video input object or reuses an existing video input object, if one exists that has the same video format and adaptor.