This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Disconnecting and Cleaning Up

Disconnecting an Instrument Object

When you no longer need an instrument object, you should disconnect it from the instrument, and clean up the MATLAB® workspace by removing the object from memory and from the workspace.

To disconnect your communication with the instrument, use the fclose function.


You can examine the Status property to verify that the object and the instrument are disconnected.

ans =

After fclose is issued, the resources associated with g are made available, and you can once again connect an instrument object to the instrument with fopen.

Cleaning Up the MATLAB Workspace

To remove the instrument object from memory, use the delete function.


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

clear g

If you use clear on an object that is connected to an instrument, the object is removed from the workspace but remains connected to the instrument. You can restore cleared instrument objects to the MATLAB workspace with the instrfind function.

Was this topic helpful?