Data Acquisition Toolbox    

Cleaning Up

When you no longer need a device object, you should clean up the MATLAB environment by removing the object from memory (the engine) and from the workspace. These are the steps you take to end a data acquisition session.

You remove device objects from memory with the delete function. For example, to delete the analog input object ai created in the preceding section:

A deleted device object is invalid, which means that you cannot connect it to the hardware. In this case, you should remove the object from the MATLAB workspace. To remove device objects and other variables from the MATLAB workspace, use the clear command.

If you use clear on a device object that is connected to hardware, the object is removed from the workspace but remains connected to the hardware. You can restore cleared device objects to MATLAB with the daqfind function.


  Stopping the Device Object Getting Started with Analog Input