Documentation Center

  • Trial Software
  • Product Updates

clear

Remove device objects from MATLAB workspace

Syntax

clear obj
clear obj.Channel(index)
clear obj.Line(index)

    Note:   You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.

Arguments

obj

A device object or array of device objects.

obj.Channel(index)

One or more channels contained by obj.

obj.Line(index)

One or more lines contained by obj.

Description

clear obj removes obj and all associated channels or lines from the MATLAB workspace, but not from the data acquisition engine.

clear obj.Channel(index) removes the specified channels contained by obj from the MATLAB workspace, but not from the data acquisition engine.

clear obj.Line(index) removes the specified lines contained by obj from the MATLAB workspace, but not from the data acquisition engine.

Examples

Create the analog input object ai, copy ai to a new variable aicopy, and then clear the original device object from the MATLAB workspace.

ai = analoginput('winsound');
ch = addchannel(ai,1:2);
aicopy = ai;
clear ai

Retrieve ai from the engine with daqfind, and show you that ai is identical to aicopy.

ainew = daqfind;
isequal(aicopy,ainew)
ans =
     1

More About

expand all

Tips

Clearing device objects, channels, and lines follows these rules:

  • clear does not remove device objects, channels, or lines from the data acquisition engine. Use the delete function for this purpose.

  • If multiple references to a device object exist in the workspace, clearing one reference will not invalidate the remaining references.

  • You can restore cleared device objects to the MATLAB workspace with the daqfind function.

If you use the help command to display the file help for clear, then you must supply the pathname shown below.

help daq/private/clear

See Also

|

Was this topic helpful?