| 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 |
delete(obj)
obj | An instrument object or an array of instrument objects. |
delete(obj) removes obj from memory.
When you delete obj, it becomes an invalid object. Because you cannot connect an invalid object to the instrument, you should remove it from the workspace with the clear command. If multiple references to obj exist in the workspace, then deleting one reference invalidates the remaining references.
If obj is connected to the instrument, it has a Status property value of open. If you issue delete while obj is connected, the connection is automatically broken. You can also disconnect obj from the instrument with the fclose function.
If obj is an interface object that is associated with a device object, the device object is automatically deleted when obj is deleted. However, if obj is a device object, the interface object is not automatically deleted when obj is deleted.
This example creates the GPIB object g, connects g to the instrument, writes and reads text data, disconnects g, removes g from memory using delete, and then removes g from the workspace using clear.
g = gpib('ni',0,1);
fopen(g)
fprintf(g,'*IDN?')
idn = fscanf(g);
fclose(g)
delete(g)
clear gclear, fclose, instrhelp, isvalid, stopasync
![]() | connect | devicereset | ![]() |

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 |