Simscape Multibody states from Simulink state vector
[vector_mgr, mech_states] = mech_get_states(X, block)
[vector_mgr, mech_states] = mech_get_states(X, vectorMgr)
[vector_mgr, mech_states] = mech_get_states(X, block) returns
a state vector manager object. The object's values reflect the Simscape™ Multibody™ states
in the Simulink® state vector
X for the Simscape Multibody machine
block. The function also returns the
[vector_mgr, mech_states] = mech_get_states(X, vectorMgr) extracts
the mechanical states from the Simulink state vector
returns them as an array of states assigned to
The returned vector manager is an instance of the
the same class as returned by the
mech_get_states accepts two possible combinations
of two inputs.
The Simulink state vector for your model.
A string or block handle specifying the absolute path of a block in the machine that you want to query.
A mechanical state vector manager object of the
mech_get_states produces one or two outputs.
An instance of the
A vector of the mechanical state values. Identical to
Simulate a Stewart platform model for 10 seconds, capturing the model state over the entire simulation:
simOut = sim('mech_stewart_trajectory','StopTime','10', ... 'SaveState','on','StateSaveName','xout'); xout = simOut.get('xout');
Populate the state vector manager with this model's final state:
stewartStateVectorMgr = mech_get_states(xout(end,:), ... 'mech_stewart_trajectory/Plant/Machine Environment');