| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Instrument Control Toolbox |
| Contents | Index |
| Learn more about Instrument Control Toolbox |
clear obj
obj | An instrument object or an array of instrument objects. |
clear obj removes obj from the MATLAB workspace.
If obj is connected to the instrument and it is cleared from the workspace, then obj remains connected to the instrument. You can restore obj to the workspace with the instrfind function. An object connected to the instrument has a Status property value of open.
To disconnect obj from the instrument, use the fclose function. To remove obj from memory, use the delete function. You should remove invalid instrument objects from the workspace with clear.
This example creates the GPIB object g, copies g to a new variable gcopy, and clears g from the MATLAB workspace. g is then restored to the workspace with instrfind and is shown to be identical to gcopy.
g = gpib('ni',0,1);
gcopy = g;
clear g
g = instrfind;
isequal(gcopy,g)
ans =
1delete, fclose, instrfind, instrhelp, isvalid
![]() | binblockwrite | clrdevice | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |