Magic Model Analyst can make connection to a running MATLAB session, thus all variables in the workspace can be used.


To connect Magic Model Analyst 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 Magic Model Analyst will be used instead of the shared one.

After the session connection, Magic Model Analyst 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 Magic Model Analyst. These two groups of variables are then merged and can be accessed in MATLAB as shown in the following figure.

Variables in the shared MATLAB workspace can be used in either Magic Model Analyst or MATLAB.