| Instrument Control Toolbox | ![]() |
Returning Property Names and Property Values
Once the instrument 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.
For example, the configurable properties for the GPIB object g are shown below. The base properties are listed first, followed by the GPIB-specific properties.
g = gpib('ni',0,1);
set(g)
ByteOrder: [ {littleEndian} | bigEndian ]
BytesAvailableAction
BytesAvailableActionCount
BytesAvailableActionMode: [ {eosCharCode} | byte ]
ErrorAction
InputBufferSize
Name
OutputBufferSize
OutputEmptyAction
RecordDetail: [ {compact} | verbose ]
RecordMode: [ {overwrite} | append | index ]
RecordName
Tag
Timeout
TimerAction
TimerPeriod
UserData
GPIB specific properties:
BoardIndex
CompareBits
EOIMode: [ {on} | off ]
EOSCharCode
EOSMode: [ {none} | read | write | read&write ]
PrimaryAddress
SecondaryAddress
You can use the get function to return one or more properties and their current values to a variable or to the command line.
For example, all the properties and their current values for the GPIB object g are shown below. The base properties are listed first, followed by the GPIB-specific properties.
get(g)
ByteOrder = littleEndian
BytesAvailable = 0
BytesAvailableAction =
BytesAvailableActionCount = 48
BytesAvailableActionMode = eosCharCode
BytesToOutput = 0
ErrorAction =
InputBufferSize = 512
Name = GPIB0-1
OutputBufferSize = 512
OutputEmptyAction =
RecordDetail = compact
RecordMode = overwrite
RecordName = record.txt
RecordStatus = off
Status = closed
Tag =
Timeout = 10
TimerAction =
TimerPeriod = 1
TransferStatus = idle
Type = gpib
UserData = []
ValuesReceived = 0
ValuesSent = 0
GPIB specific properties:
BoardIndex = 0
BusManagementStatus = [1x1 struct]
CompareBits = 8
EOIMode = on
EOSCharCode = 10
EOSMode = none
HandshakeStatus = [1x1 struct]
PrimaryAddress = 1
SecondaryAddress = 0
To display the current value for one property, you supply the property name to get.
get(g,'OutputBufferSize') ans = 512
To display the current values for multiple properties, you include the property names as elements of a cell array.
get(g,{'BoardIndex','TransferStatus'})
ans =
[0] 'idle'
You can also use the dot notation to display a single property value.
g.PrimaryAddress
ans =
1
| Configuring and Returning Properties | Configuring Property Values | ![]() |