| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → SimMechanics |
| Contents | Index |
| Learn more about SimMechanics |
[vector_mgr, mech_states] = mech_get_states(X, block)
[vector_mgr, mech_states] = mech_get_states(X, vectorMgr)
vector_mgr = 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 SimMechanics states in the Simulink state vector X for the SimMechanics machine containing block. The function also returns the mechanical states vector_mgr.X in mech_states.
[vector_mgr, mech_states] = mech_get_states(X, vectorMgr) extracts the mechanical states from the Simulink state vector X and returns them as an array of states suitable for assignment into vectorMgr.X. The state vector manager vectorMgr is not modified.
vector_mgr = mech_get_states(X, vectorMgr) returns a state vector manager object only.
The returned vector manager is an instance of the MECH.StateVectorMgr class, the same class as returned by the mech_stateVectorMgr function.
mech_get_states accepts two possible combinations of two inputs.
X |
The Simulink state vector for your model. X must be compatible with your Simulink model. |
block |
A string or block handle specifying the absolute path of a block in the machine that you want to query. |
vectorMgr |
A mechanical state vector manager object of the MECH.StateVectorMgr class. |
mech_get_states produces one or two outputs.
vector_mgr |
An instance of the MECH.StateVectorMgr object class whose values reflect the mechanical state of the model. |
mech_states |
A vector of the mechanical state values. Identical to vector_mgr.X, if you use the first form of the function. |
Simulate a Stewart platform model for 10 seconds:
[t,x,y] = sim('mech_stewart_trajectory',10);
Then populate the state vector manager with this model's final state:
stewartStateVectorMgr = mech_get_states(x(end,:), ... 'mech_stewart_trajectory/Plant/Machine Environment')
Call any form of the function with only one output. The function returns vector_mgr. Thus, the three entries at the command line
vm = mech_stateVectorMgr(block); [vm , mech_states] = mech_get_states(X, vm); vm.X = mech_states;
are equivalent to
vm = mech_get_states(X, block);
mech_runtime_states | mech_set_states | mech_stateVectorMgr | mech_transfer_states | sim | states
![]() | import_physmod | mech_import | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |