| Data Acquisition Toolbox | ![]() |
Returning Property Names and Property Values
Once the device object is created, you can use the set function to return all configurable properties to a variable or to the command line. Additionally, if a property has a finite set of string values, then set also returns these values. You can use the get function to return one or more properties and their current values to a variable or to the command line.
The syntax used to return common and channel/line properties is described below. The examples are based on the analog input object ai created for a sound card and containing two channels.
Common Properties
To return all configurable common property names and their possible values for a device object, you must supply the device object to set. For example, all configurable common properties for ai are shown below. The base properties are listed first, followed by the device-specific properties.
set(ai) BufferingConfig BufferingMode: [ {Auto} | Manual ] Channel ChannelSkew ChannelSkewMode: [ {None} ] ClockSource: [ {Internal} ] DataMissedFcn InputOverRangeFcn InputType: [ {AC-Coupled} ] LogFileName LoggingMode: [ Disk | {Memory} | Disk&Memory ] LogToDiskMode: [ {Overwrite} | Index ] ManualTriggerHwOn: [ {Start} | Trigger ] Name RuntimeErrorFcn SampleRate SamplesAcquiredFcn SamplesAcquiredFcnCount SamplesPerTrigger StartFcn StopFcn Tag Timeout TimerFcn TimerPeriod TriggerFcn TriggerChannel TriggerCondition: [ {None} ] TriggerConditionValue TriggerDelay TriggerDelayUnits: [ {Seconds} | Samples ] TriggerRepeat TriggerType: [ Manual | {Immediate} | Software ] UserData WINSOUND specific properties: BitsPerSample StandardSampleRates: [ Off | {On} ]
To return all common properties and their current values for a device object, you must supply the device object to get. For example, all common properties for ai are shown below. The base properties are listed first, followed by the device-specific properties.
get(ai) BufferingConfig = [512 30] BufferingMode = Auto Channel = [2x1 aichannel] ChannelSkew = 0 ChannelSkewMode = None ClockSource = Internal DataMissedFcn = @daqcallback EventLog = [] InitialTriggerTime = [0 0 0 0 0 0] InputOverRangeFcn = InputType = AC-Coupled LogFileName = logfile.daq Logging = Off LoggingMode = Memory LogToDiskMode = Overwrite ManualTriggerHwOn = Start Name = winsound0-AI Running = Off RuntimeErrorFcn = @daqcallback SampleRate = 8000 SamplesAcquired = 0 SamplesAcquiredFcn = SamplesAcquiredFcnCount = 1024 SamplesAvailable = 0 SamplesPerTrigger = 8000 StartFcn = StopFcn = Tag = Timeout = 1 TimerFcn = TimerPeriod = 0.1 TriggerFcn = TriggerChannel = [1x0 aichannel] TriggerCondition = None TriggerConditionValue = 0 TriggerDelay = 0 TriggerDelayUnits = Seconds TriggerRepeat = 0 TriggersExecuted = 0 TriggerType = Immediate Type = Analog Input UserData = [] WINSOUND specific properties: BitsPerSample = 16 StandardSampleRates = On
To display the current value for one property, you supply the property name to get.
To display the current values for multiple properties, you include the property names as elements of a cell array.
You can also use the dot notation to display a single property value.
Channel and Line Properties
To return all configurable channel (line) property names and their possible values for a single channel (line) contained by a device object, you must use the Channel (Line) property. For example, to display the configurable channel properties for the first channel contained by ai,
All channel properties and their current values for the first channel contained by ai are shown below.
get(ai.Channel(1)) ChannelName = Left HwChannel = 1 Index = 1 InputRange = [-1 1] NativeOffset = 1.5259e-005 NativeScaling = 3.0518e-005 Parent = [1x1 analoginput] SensorRange = [-1 1] Type = Channel Units = Volts UnitsRange = [-1 1]
As described in the preceding section, you can also return values for a specified number of channel properties with the get function or the dot notation.
| Configuring and Returning Properties | Configuring Property Values | ![]() |