MATLAB Examples

Retrieve Model Properties

The property values in an existing model are retrievable. Working with models resembles working with struct arrays because you can access model properties using dot notation. That is, type the model name, then the property name, separated by '.' (a period).

For example, consider the arima model with this AR(2) specification:

Mdl = arima('AR',{0.8,-0.2},'Variance',0.2,'Constant',0);

To display the value of the property AR for the created model, enter:

arCoefficients = Mdl.AR
arCoefficients =

  1x2 cell array

    {[0.8000]}    {[-0.2000]}

AR is a cell array, so you must use cell-array syntax. The coefficient cell arrays are lag-indexed, so entering

secondARCoefficient = Mdl.AR{2}
secondARCoefficient =

   -0.2000

returns the coefficient at lag 2. You can also assign any property value to a new variable:

ar = Mdl.AR
ar =

  1x2 cell array

    {[0.8000]}    {[-0.2000]}