Remove device objects, channels, or lines from data acquisition engine
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.
A device object or array of device objects.
One or more channels contained by obj.
One or more lines contained by obj.
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.
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:
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:
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.
If hardware channel 1 is deleted instead, an error is returned.
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.