| Data Acquisition Toolbox | Search  Help Desk |
Device Objects, Channels, and Lines
Data acquisition device objects are the basic toolbox elements you use to access your hardware device. Channels and lines are the basic hardware device elements with which data acquisition tasks are performed.Device Objects
Device objects provide a gateway to the functionality of your hardware, and allow you to control the behavior of your acquisition. Each device object is associated with a specific hardware subsystem. The device objects supported by the Data Acquisition Toolbox allow you to access analog input (AI), analog output (AO), and digital I/O (DIO) subsystems. The association between device objects and hardware subsystems is shown below.
daqhwinfo function. For example, the following command returns the constructor syntax for the susbsystems that are supported by a sound card.
hwinfo = daqhwinfo('winsound');
hwinfo.ObjectConstructorName(:)
ans =
'analoginput('winsound',0)'
'analogoutput('winsound',0)'
Creating a Device Object
To create a device object, you call specific M-file functions called object creation functions (or constructors). These M-files are based on MATLAB object-oriented programming capabilities, which is described in the Using MATLAB book. For example, to create an analog input object for a sound card, you issue the commandai = analoginput('winsound');
set(ai, 'SampleRate', 8000)