| Data Acquisition Toolbox | Search  Help Desk |
Creating an Analog Input Object
Before executing an analog input (AI) task, an analog input object must be created. You create an AI object with the commandAI = analoginput('adaptor', ID);
analoginput is the analog input object creation function
adaptor is the hardware driver adaptor name
ID is the vendor-specific device label
AI is the analog input object
Name property. The name is created by concatenating the name of the adaptor, the device label, and the device object type. You can change the value of Name at any time. For sound cards, only the name of the adaptor and the device object type is used.
addchannel function must be used.
Example: Create an Analog Input Object
Suppose you want to create the analog input objectAI for a sound card. Since there is no device label for the sound card, the analog input object creation function requires only the adaptor name as an argument.
AI = analoginput('winsound');
AI now exists in the MATLAB workspace and the engine. The device object's name can now be displayed.
get(AI,'Name')
ans =
winsound0-AI
If you are familiar with Handle Graphics®, then AI may look like a handle to you. In fact, it is not a handle but a Data Acquisition Toolbox object. To verify this, type whos AI at the command line.
whos AI Name Size Bytes Class AI 1x1 1332 analoginput object Grand total is 52 elements using 1332 bytes
AI cannot yet be used to acquire data since it has no hardware channels associated with it. Additionally, property values must be set to establish the required behavior for your specific application.