| Data Acquisition Toolbox | Search  Help Desk |
Execution
Execution is divided into three main categories:Starting
You start a device object with thestart command
start(AI)
start command is issued, the Data Acquisition Toolbox enters the running state. This means that both the hardware device and data acquisition engine are executing according to the configured properties. Once a trigger occurs, data logging to memory and/or a disk file is initiated for an analog input object, while data output is initiated for analog output objects.
Previewing, Acquiring, or Sending Data
While the device object and data acquisition engine are running, you can preview, acquire (for analog input), or send (for analog output) data. These topics are discussed below. Preview or Acquire Data. For analog input objects, data can be previewed with thepeekdata 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
data = peekdata(AI, 500);
peekdata does not guarantee that all requested data is returned. You can preview data any time after the trigger occurs as long as the object is running.
Data can also be extracted from the data acquisition engine with the getdata function. For example, to extract 500 samples from the engine
data = getdata(AI, 500);
getdata blocks execution control until all the requested data is returned. You can extract data any time after the trigger occurs.
Send Data.
For analog output objects, data can be queued in the engine for output to an analog output (D/A) hardware device with the putdata function. For example, to queue 500 samples to the engine
data = sin(0:0.01:2*pi)';
putdata(AO, data(1:500))
You can queue data either before or after start is issued. Queued data can be output only after the trigger occurs.
Stopping
A device object can stop under one of these conditions:stop command is issued
Runtime errors can include hardware errors and timeouts. A timeout can occur if the data requested from the engine is not extracted in a predetermined amount of time.
start command using the current configuration.