Documentation Center

  • Trial Software
  • Product Updates

delete

Remove device objects, channels, or lines from data acquisition engine

Syntax

delete(obj)
delete(obj.Channel(index))
delete(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

delete(obj) removes the device object specified by obj from the engine. If obj contains channels or lines, they are removed as well. If obj is the last object accessing the driver, then the driver and associated adaptor are unloaded.

delete(obj.Channel(index)) removes the channels specified by index and contained by obj from the engine. As a result, the remaining channels might be reindexed.

delete(obj.Line(index)) removes the lines specified by index and contained by obj from the engine. As a result, the remaining lines might be reindexed.

Examples

National Instruments

Create the analog input object ai for a National Instruments® board, add hardware channels 0-7 to it, and make a copy of hardware channels 0 and 1.

ai = analoginput('nidaq','Dev1');
addchannel(ai,0:7);
ch = ai.Channel(1:2);

To delete hardware channels 0 and 1:

delete(ch)

These channels are deleted from the data acquisition engine and are no longer associated with ai. The remaining channels are reindexed such that the indices begin at 1 and increase monotonically to 6. To delete ai:

delete(ai)

Sound Card

Create the analog input object AI1 for a sound card, and configure it to operate in stereo mode.

AI1 = analoginput('winsound');
addchannel(AI1,1:2);

You can now configure the sound card for mono mode by deleting hardware channel 2.

delete(AI1.Channel(2))

If hardware channel 1 is deleted instead, an error is returned.

More About

expand all

Tips

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

  • delete removes device objects, channels, or lines from the data acquisition engine but not from the MATLAB workspace. To remove variables from the workspace, use the clear function.

  • If multiple references to a device object exist in the workspace, then removing one device object from the engine invalidates the remaining references. These remaining references should be cleared from the workspace with the clear function.

  • If you delete a device object while it is running, then a warning is issued before it is deleted. You cannot delete a device object while it is logging or sending data.

You should use delete at the end of a data acquisition session. You can quickly delete all existing device objects with the command delete(daqfind).

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

help daq/daqdevice/delete

See Also

|

Was this topic helpful?