| Data Acquisition Toolbox | Search  Help Desk |
Setting and Verifying Hardware Properties
For theChannelSkew, InputRange, and SampleRate properties, data acquisition devices have a finite (though sometimes large) number of valid values that can be set. If you specify a property value that does not match one of the valid device values, then the data acquisition engine will choose a valid value automatically. The rules the engine uses to select a valid property value are described for each property in Chapter 7, "Property Reference".
You can use the propinfo function to obtain information about the valid values for some of these properties. For example, suppose you create the analog input object AI for a sound card. You can use propinfo to display information about the SampleRate property.
AI = analoginput('winsound')
propinfo(AI, 'SampleRate')
ans =
Type: 'double'
Constraint: 'Bounded'
ConstraintValue: [8000 44100]
DefaultValue: 8000
ReadOnly: 0
ReadOnlyRunning: 1
DeviceSpecific: 0
The Constraint field describes the constraints on the property value, while the ConstraintValue field gives the property value constraint. In the example above, Bounded means there are a large number of valid values for SampleRate and ConstraintValue gives the upper and lower limits (the bounds) for SampleRate. For more information about propinfo, refer to Chapter 6, "Function Reference."
Note:
AI = analoginput('nidaq', 1)
addchannel(AI, 0:7)
set(AI, 'SampleRate', 5000)
ActualRate = get(AI,'SampleRate')
duration = 10 % Ten second acquisition
set(AI, 'SamplesPerTrigger', duration*ActualRate)
As an alternative to the syntax shown above, you can use the setverify function. setverify is equivalent to the commands
set(obj, 'Property', Value) Actual = get(obj, 'Property')Using
setverify, the previous example is written as
AI = analoginput('nidaq', 1)
addchannel(AI, 0:7)
ActualRate = setverify(AI,'SampleRate', 5000)
duration = 10 % Ten second acquisition
set(AI, 'SamplesPerTrigger', duration*ActualRate)