Data Acquisition Toolbox | ![]() ![]() |
Where Do Device Objects Exist?
When you create a device object, it exists in both the MATLAB workspace and the data acquisition engine. For example, suppose you create the analog input object ai
for a sound card and then make a copy of ai
.
The copied device object newai
is identical to the original device object ai. You can verify this by setting a property value for ai
and returning the value of the same property from newai
.
As shown below, ai
and newai
return the same property value because they both reference the same device object in the data acquisition engine.
If you delete either the original device object or a copy, then the engine device object is also deleted. In this case, you cannot use any copies of the device object that remain in the workspace because they are no longer associated with any hardware. Device objects that are no longer associated with hardware are called invalid objects. The example below illustrates this situation.
delete(ai); newai newai = Invalid Data Acquisition object. This object is not associated with any hardware and should be removed from your workspace using CLEAR.
You should remove invalid device objects from the workspace with the clear
command.
![]() | Creating an Array of Device Objects | Adding Channels or Lines | ![]() |