Quantcast

Documentation Center

  • Trial Software
  • Product Updates

set

Configure or display device object properties

Syntax

set(obj)
props = set(obj)
set(obj,'PropertyName')
props = set(obj,'PropertyName')
set(obj,'PropertyName',PropertyValue,...)
set(obj,PN,PV)
set(obj,S)

    Note:   You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.

Arguments

obj

A device object, array of device objects, channels, or lines.

'PropertyName'

A property name.

PropertyValue

A property value.

PN

A cell array of property names.

PV

A cell array of property values.

S

A structure whose field names are device object, channel, or line properties.

props

A structure array whose field names are the property names for obj, or a cell array of possible values.

Description

set(obj) displays all configurable properties for obj. If a property has a finite list of possible string values, then these values are also displayed.

props = set(obj) returns all configurable properties to props. props is a structure array with fields given by the property names, and possible property values contained in cell arrays. if the property does not have a finite set of possible values, then the cell array is empty.

set(obj,'PropertyName') displays the valid values for the property specified by PropertyName. PropertyName must have a finite set of possible values.

props = set(obj,'PropertyName') returns the valid values for PropertyName to props. props is a cell array of possible values or an empty cell array if the property does not have a finite set of possible values.

set(obj,'PropertyName',PropertyValue,...) sets multiple property values with a single statement. Note that you can use structures, property name/property value string pairs, and property name/property value cell array pairs in the same call to set.

set(obj,PN,PV) sets the properties specified in the cell array of strings PN to the corresponding values in the cell array PV. PN must be a vector. PV can be m-by-n where m is equal to the specified number of device objects, channels, or lines and n is equal to the length of PN.

set(obj,S) where S is a structure whose field names are device object properties, sets the properties named in each field name with the values contained in the structure.

Examples

Create the analog input object ai for a sound card and configure it to operate in stereo mode.

ai = analoginput('winsound');
addchannel(ai,1:2);

To display all of ai's configurable properties and their valid values:

set(ai)

To set the value for the SampleRate property to 10000:

set(ai,'SampleRate',10000)

The following two commands set the value for the SampleRate and InputType properties using one call to set.

set(ai,'SampleRate',10000,'TriggerType','Manual')
set(ai,{'SampleRate','TriggerType'},{10000,'Manual'})

You can also set different channel property values for multiple channels.

ch = ai.Channel(1:2);
set(ch,{'UnitsRange','ChannelName'},{[-1 1] 'Name1'; [-2 2]
'Name2'})

More About

expand all

Tips

If you use the help command to display the help for set, then you must supply the pathname shown below.

help daq/daqdevice/set

See Also

|

Was this topic helpful?