| Data Acquisition Toolbox | Search  Help Desk |
Basic Setup Properties
For most data acquisition applications, there is a set of properties used to configure the basic setup for your session. These properties provide access to individual channels and control the sampling rate, triggers, and the number of samples to acquire per trigger. Properties related to the basic setup are given below.Accessing Individual Channels
As discussed in "Property Names and Property Values", the Data Acquisition Toolbox supports two basic types of properties for analog input objects: common properties and channel properties. Common properties apply to all channels contained by the device object while channel properties can be configured for individual channels.Channel contains all the channels associated with an analog input object as created with addchannel. Using Channel, you can:
set command
get command
Channel to configure channel properties is illustrated in "Data Range and Engineering Units Properties".
Setting the Sampling Rate
The per-channel rate at which data is acquired is controlled with theSampleRate property. SampleRate must be specified as samples per second. For example, to set the sampling rate of your sound card to 44,100 samples per second (44.1 kHz)
set(ai, 'SampleRate', 44100);
SampleRate, you should find out the actual rate set by the hardware driver.
ActualRate = get(ai, 'SampleRate')
SampleRate is 8 kHz for most sound cards. For other hardware devices, the default value is supplied by the hardware driver.
Defining a Trigger
For analog input objects, a trigger is defined as an event that initiates data logging to memory and/or a disk file. TheTriggerType property specifies the type of trigger to be issued. The valid TriggerType values that are supported for all hardware devices are given below.TriggerType determines whether additional trigger properties must be set.
Triggering can be a complicated issue and it has many associated properties. For detailed information about triggering, refer to "Configuring Triggers".
Setting the Samples to Acquire per Trigger
When a trigger executes, the number of samples to be acquired per trigger specified is acquired for each channel group member and stored in the data acquisition engine and/or written to a log file. The number of samples to acquire per trigger is configured with theSamplesPerTrigger property.
set(ai, 'SamplesPerTrigger', 8000);
SamplesPerTrigger is calculated by the engine such that one second of data is collected, and is based on the value of SampleRate. In general, to calculate the acquisition time for each trigger issued, you apply the formula
SamplesPerTrigger/SampleRate