Main Content

get

Access model property values

Syntax

Value = get(sys,'PropertyName')
Struct = get(sys)

Description

Value = get(sys,'PropertyName') returns the current value of the property PropertyName of the model object sys. 'PropertyName' can be the full property name (for example, 'UserData') or any unambiguous case-insensitive abbreviation (for example, 'user'). See reference pages for the individual model object types for a list of properties available for that model.

Struct = get(sys) converts the TF, SS, or ZPK object sys into a standard MATLAB® structure with the property names as field names and the property values as field values.

Without left-side argument,

get(sys)

displays all properties of sys and their values.

Examples

collapse all

Create the following discrete-time SISO transfer function model:

H(z)=1z+2

Specify the sample time as 0.1 seconds and input channel name as Voltage.

h = tf(1,[1 2],0.1,'InputName','Voltage')
h =
 
  From input "Voltage" to output:
    1
  -----
  z + 2
 
Sample time: 0.1 seconds
Discrete-time transfer function.

Display all the properties of the transfer function.

get(h)
       Numerator: {[0 1]}
     Denominator: {[1 2]}
        Variable: 'z'
         IODelay: 0
      InputDelay: 0
     OutputDelay: 0
       InputName: {'Voltage'}
       InputUnit: {''}
      InputGroup: [1x1 struct]
      OutputName: {''}
      OutputUnit: {''}
     OutputGroup: [1x1 struct]
           Notes: [0x1 string]
        UserData: []
            Name: ''
              Ts: 0.1000
        TimeUnit: 'seconds'
    SamplingGrid: [1x1 struct]

Display the numerator of the transfer function.

num = get(h,'Numerator')
num = 1x1 cell array
    {[0 1]}

The numerator data is stored as a cell array, thus the Numerator property is a cell array containing the row vector [0 1].

num{1}
ans = 1×2

     0     1

Display the sample time Ts of the transfer function.

get(h,'Ts')
ans = 
0.1000

Alternatively, use dot notation to access the property value.

h.Ts
ans = 
0.1000

Tips

An alternative to the syntax

Value = get(sys,'PropertyName')

is the structure-like referencing

Value = sys.PropertyName

For example,

sys.Ts
sys.A
sys.user

return the values of the sample time, A matrix, and UserData property of the (state-space) model sys.

Version History

Introduced before R2006a