Data Acquisition Toolbox    
SampleRate

Specify the per-channel rate at which analog data is converted to digital data, or digital data is converted to analog data

Description

SampleRate specifies the per-channel rate (in samples/second) that an analog input (AI) or analog output (AO) subsystem converts data. AI subsystems convert analog data to digital data, while AO subsystems convert digital data to analog data.

AI and AO subsystems have a finite (though often large) number of valid sampling rates. If you specify a sampling rate that does not match one of the valid values, then the data acquisition engine automatically selects the next highest supported sampling rate that is within 1% of the requested rate. If there is no valid sampling rate within this tolerance, the next highest value is selected. If a higher value is not available, then an error is returned.

Because the engine can set the sampling rate to a value that differs from the value you specify, you should return the actual sampling rate using the get function or the device object display summary. Alternatively, you can use the setverify function, which sets the SampleRate value and then returns the actual value that is set. To find out the range of sampling rates supported by your board, use the propinfo function. Additionally, because the actual sampling rate depends on the number of channels contained by the device object and the ChannelSkew property value (AI only), SampleRate should be the last property you set before starting the device object.

Characteristics

Usage
AI, AO, Common
Access
Read/write
Data type
Double
Read-only when running
Yes

Values

The default value is obtained from the hardware driver.

Example

Create the analog input object ai for a sound card and add two channels to it.

You can find out the range of valid sampling rates with the ConstraintValue field of the propinfo function.

To configure the per-channel sampling rate to 48 kHz:

Alternatively, you can use the setverify function to configure and return the SampleRate value.

See Also

Functions

propinfo, setverify

Properties

ChannelSkew


  RuntimeErrorFcn SamplesAcquired