%% Extract ODE Option Values
% Create an options structure using odeset that contains several values for different options.

M = @(t) [t 0; 0 -t];
options = odeset('RelTol',1e-4,'AbsTol',1e-5,'OutputFcn',@odephas2,...
    'Mass',M,'MassSingular','no','MStateDependence','none')

%
% Use odeget to extract the value of the OutputFcn field from the options structure.

v = odeget(options,'OutputFcn')

%
% Now extract the value of the Refine field. Since this field is not set, odeget returns an empty matrix [].

v = odeget(options,'Refine')

%
% You can specify a third input to odeget to change the default return value. This ensures that v is never empty.

v = odeget(options,'Refine',1)

% Copyright 2012 The MathWorks, Inc.