States and inputs from operating points
x = getxu(op_point)
[x,u] = getxu(op_point)
[x,u,xstruct] = getxu(op_point)
[x,u] = getxu(op_point) extracts a vector of state values, x, and a vector of input values, u, from the operating point object, op_point. States in x and inputs in u are ordered in the same way as for Simulink.
[x,u,xstruct] = getxu(op_point) extracts a vector of state values, x, a vector of input values, u, and a structure of state values, xstruct, from the operating point object, op_point. The structure of state values, xstruct, has the same format as that returned from a Simulink simulation. States in x and xstruct and inputs in u are ordered in the same way as for Simulink.
Create an operating point object for the magball model by typing:
To view the states within this operating point, type:
(1.) magball/Controller/PID Controller/Filter x: 0 (2.) magball/Controller/PID Controller/Integrator x: 14 (3.) magball/Magnetic Ball Plant/Current x: 7 (4.) magball/Magnetic Ball Plant/dhdt x: 0 (5.) magball/Magnetic Ball Plant/height x: 0.05
To extract a vector of state values, with the states in an ordering that is compatible with Simulink, along with inputs and a state structure, type:
This syntax returns:
x = 0.0500 0 14.0071 7.0036 0 u =  xstruct = time: 0 signals: [1x5 struct]
View xstruct in more detail by typing:
This syntax displays:
ans = 1x5 struct array with fields: values dimensions label blockName stateName inReferencedModel sampleTime
View each component of the structure individually. For example:
xstruct.signals(1).values ans = 0
xstruct.signals(2).values ans = 7.0036
You can import these vectors and structures into Simulink as initial conditions or input vectors or use them with setxu, to set state and input values in another operating point.