Simulation Toolkit can make connection to a running MATLAB session, thus all variables in the workspace can be used.
To connect Simulation Toolkit to a running MATLAB session through sharing
- Execute the matlab.engine.shareEngine command through the MATLAB Command window.
Note
- MATLAB must be integrated successfully before the connection is made.
- If the sharing command shown above is not executed, the other MATLAB session loaded by Simulation Toolkit will be used instead of the shared one.
After the session connection, Simulation Toolkit can access variables in the MATLAB shared workspace that are not in the SysML model. You can define some variables in MATLAB, e.g., m1 and m2 and solve parametric in Simulation Toolkit. These two groups of variables are then merged and can be accessed in MATLAB as shown in the following figure.