Configure and Return Properties


You define and evaluate the behavior of your data acquisition application with device object properties.

Property Types

Data Acquisition Toolbox™ properties are divided into two main types:

  • Common properties — Common properties apply to every channel or line contained by a device object.

  • Channel/Line properties — Channel/line properties are configured for individual channels or lines.

The relationship between an analog input object, the channels it contains, and their properties is shown below.

For digital I/O objects, the diagram would look the same except that lines would be substituted for channels.

Common properties and channel/line properties are subdivided into these two categories:

  • Base properties — Base properties apply to all supported hardware subsystems of a given type, such as analog input. For example, the SampleRate property is supported for all analog input subsystems regardless of the vendor.

  • Device-specific properties — Device-specific properties apply only to specific hardware devices. For example, the BitsPerSample property is supported only for sound cards. Note that base properties can have device-specific values. For example, the InputType property has a different set of values for each supported hardware vendor.

The relationship between common properties, channel/line properties, base properties, and device-specific properties is shown below.

For a complete description of all properties, refer to properties.

Return Property Names and Property Values

Once the device object is created, you can set the values of all configurable properties..

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.

ai = analoginput('winsound');

Configure Property Values

You configure property values at any time while the device object exists. However, some properties are not configurable while the object is running. Use the propinfo function, or refer to the function properties for information about when a property is configurable.

The syntax used to configure common and channel/line properties is described below. The examples are based on the analog input object ai created in Return Property Names and Property Values.

Common Properties

You can configure a single property value:

ai.TriggerType = 'Manual';

Channel and Line Properties

To configure channel (line) properties for one or more channels (lines) contained by a device object, you must use the Channel (Line) property. For example, to configure the SensorRange property for the first channel contained by ai.

ch1 = ai.Channel(1)
ch1.SensorRange = [-2 2];

To configure values for multiple channel or line properties:

ch1.SensorRange = [-2 2]
ch1.ChannelName = 'Chan1'

Specify Property Names

Device object property names are presented in this guide using mixed case. While this makes the names easier to read, you can use any case you want when specifying property names. Additionally, you need use only enough letters to identify the property name uniquely, so you can abbreviate most property names. For example, you can configure the SampleRate property any of these ways.

ai.SampleRate = 44100
ai.samplerate = 44100
ai.sampler = 44100

However, when you include property names in a file, you should use the full property name. This practice can prevent problems with future releases of Data Acquisition Toolbox software if a shortened name is no longer unique because of the addition of new properties.

Default Property Values

If you do not explicitly define a value for a property, then the default value is used. All configurable properties have default values. However, the default value for a given property might vary based on the hardware you are using. Additionally, some default values are calculated by the engine and depend on the values set for other properties. If the hardware driver adaptor specifies a default value for a property, then that value takes precedence over the value defined by the toolbox.

If a property has a finite set of string values, then the default value is enclosed by {} (curly braces). For example, the default value for the LoggingMode property is Memory.

ai.LoggingMode = 
[ Disk | {Memory} | Disk&Memory ]

You can also use the propinfo function, or refer to the function properties to find the default value for any property.

Property Inspector

The Property Inspector is a graphical user interface (GUI) for accessing toolbox object properties. The Property Inspector is designed so you can

  • Display the names and current values for object properties

  • Display possible values for enumerated properties

  • Configure the property values

You open the Property Inspector with the inspect function, or via the Workspace browser by double-clicking an object.

For example, create the analog input object ai for a sound card and add both hardware channels.

ai = analoginput('winsound');

Open the Property Inspector from the command line.


For more information on the Property Inspector, see the inspect reference page.

Was this topic helpful?