Create an options structure using odeset
that contains several values for different options.
options =
struct with fields:
AbsTol: 1.0000e-05
BDF: []
Events: []
InitialStep: []
Jacobian: []
JConstant: []
JPattern: []
Mass: @(t)[t,0;0,-t]
MassSingular: 'no'
MaxOrder: []
MaxStep: []
NonNegative: []
NormControl: []
OutputFcn: @odephas2
OutputSel: []
Refine: []
RelTol: 1.0000e-04
Stats: []
Vectorized: []
MStateDependence: 'none'
MvPattern: []
InitialSlope: []
Use odeget
to extract the value of the OutputFcn
field from the options structure.
v =
function_handle with value:
@odephas2
Now extract the value of the Refine
field. Since this field is not set, odeget
returns an empty matrix []
.
You can specify a third input to odeget
to change the default return value. This ensures that v
is never empty.