Documentation Center

  • Trial Software
  • Product Updates

Clean Up

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

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

delete(ai)

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.

clear ai

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 the MATLAB workspace with the daqfind function.

Was this topic helpful?