| Data Acquisition Toolbox | ![]() |
Acquiring and Outputting Data
After you configure the device object, you can acquire or output data. Acquiring and outputting data involves these three steps:
As data is being transferred between MATLAB and your hardware, you can think of the device object as being in a particular state. Two types of states are defined for the Data Acquisition Toolbox:
The running state is indicated by the Running property for both analog input and analog output objects. Running can be On or Off.
Logging property. Logging can be On or Off.For analog output objects, sending means the data queued in the engine is being output to an analog output subsystem. The sending state is indicated by the Sending property. Sending can be On or Off.
Running, Logging, and Sending are read-only properties that are automatically set to On or Off by the engine. When Running is Off, Logging and Sending must be Off. When Running is On, Logging and Sending are set to On only when a trigger occurs.
| Note Digital I/O objects also possess a running state. However, since they do not store data in the engine, the logging and sending states do not exist. |
Starting the Device Object
You start a device object with the start function. For example, to start the analog input object ai
ai = analoginput('winsound')addchannel(ai,1:2)start(ai)
After start is issued, the Running property is automatically set to On, and both the device object and hardware device execute according to the configured and default property values.
While you are acquiring data with an analog input object, you can preview the data with the peekdata function. peekdata takes a "snapshot" of the most recent data but does not remove data from the engine. For example, to preview the most recent 500 samples acquired by each channel contained by ai
data = peekdata(ai,500);
Since previewing data is usually a low priority task, peekdata does not guarantee that all requested data is returned. You can preview data at any time while the device object is running.
| daqpropedit: A Graphical Property Editor | Logging or Sending Data | ![]() |