| Data Acquisition Toolbox | Search  Help Desk |
| SampleRate | Examples See Also |
SampleRate specifies the per-channel rate (in samples/second) that the analog input or analog output hardware can digitize data.
Data acquisition devices have a finite (though often large) number of valid sampling rates. To find out the range of sample rates supported by your board, you can use the propinfo function.
If you specify a sampling rate that does not match one of the valid device values, then the data acquisition engine automatically selects the closest 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.
Since SampleRate can be set to a value that differs from the one specified with the set function, you should return the actual sampling rate.
ActualRate = get(AI, 'SampleRate');
setverify function. This function sets the SampleRate value and then returns the actual value that is set.
ActualRate = setverify(AI, 'SampleRate', Value)
SampleRate value is changed, the BufferingConfig values are recalculated by the engine.
Characteristics
| Device Objects | AI, AO |
| Class | Common |
| Access | Read/write |
| Data Type | Double |
| Modify while Running | No |
Values
The default value is obtained from the hardware driver.Example
Suppose you create an analog input objectAI for a sound card and add two channels to it.
AI = analoginput('winsound')
addchannel(AI, 1:2)
You can find out the range of valid sample rates with the propinfo function.
propinfo(AI,'SampleRate')
set command to set the sample rate to 8 kHz for each channel.
set(AI, 'SampleRate', 8000);
ActualRate = get(AI, 'SampleRate');
setverify function. This function sets the sample rate value and then returns the actual value that is set.
setverify(AI, 'SampleRate', 8000)
See Also
Properties
BufferingConfig
Functions
propinfo, setverify