Using Syndeia with Simulink & Stateflow
Starting with Syndeia 3.1, users have two options to interact with the MATLAB environment (including Simulink and Stateflow). Beyond the instructions below, no further action is needed. During installation, Syndeia will automatically install the libSimulink folder.
- API-based interaction: Syndeia 3.1 offers a faster API-based interaction with the MATLAB environment. We strongly recommend using this mode with Syndeia if you are using MATLAB / Simulink / Stateflow 2016b and later. Follow the steps below to configure Syndeia to use this mode.
- Set the path to MATLAB Engine
- Windows (64 bit) - On Windows, you need to add the folder <matlabroot>\bin\win64 at the beginning of the Path environment variable value. Replace <matlabroot> with the location of MATLAB installation on your computer. To do this, go to Control Panel > System and Security > System > Advanced Settings. Click on the Environment Variables button, select the Path variable under System Variables, and add the location <matlabroot>\bin\win64 at the top of the list, as shown below.
- Mac OS XÂ (64 bit)- Open the magicdraw.properties file located in <MagicDraw Installation>/bin folder in a text editor. Add the following to the value of JAVA_ARGS variable, as shown in the screenshot below.
-Djava.library.path=/Applications/MATLAB_R2016b.app/bin/maci64
Note: Starting with Mac OS X El Capitan, the operating system has added System Integrity Protection (SIP). With the SIP turned on (by default for all users and recommended), adding the full path <matlabroot>/bin/maci64 to the path variable DYLD_LIBRARY_PATH will not work since the value of the variable will not be shared for any executable processes. Hence, specifying the path in the magicdraw.properties file is suggested, as shown above. - Linux (64 bit) - On Linux, set the value of LD_LIBRARY_PATH to the following value matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64. Replace <matlabroot> with the location of MATLAB installation on your computer.
- Windows (64 bit) - On Windows, you need to add the folder <matlabroot>\bin\win64 at the beginning of the Path environment variable value. Replace <matlabroot> with the location of MATLAB installation on your computer. To do this, go to Control Panel > System and Security > System > Advanced Settings. Click on the Environment Variables button, select the Path variable under System Variables, and add the location <matlabroot>\bin\win64 at the top of the list, as shown below.
- Place MATLAB engine.jar file in libMATLAB folderÂ
- Create a libMATLAB folder in the Syndeia installation directory <MDroot>\plugins\com.intercax.syndeia. Replace <MDroot> with the location of MagicDraw installation on your computer.
- Then navigate to <matlabroot>\extern\engines\java\jar and copy the engine.jar file, and paste into the libMATLAB folder you created. This <matlabroot> must be the same one used for (a) above.
- Set both Use MATLAB Engine API and Use existing MATLAB session to true in Syndeia's MATLAB settings after you have installed Syndeia.
- Set the path to MATLAB Engine
- File-based interaction: Syndeia 3.1 continues to provide the existing file-based interaction with the MATLAB environment (like Syndeia 3.0). If you have a version of MATLAB / Simulink / Stateflow earlier than 2016b, use this mode. To use this mode, set the path to the MATLAB executable (e.g. matlab.exe on Windows) in Syndeia's MATLAB settings after you have installed Syndeia. If you do not specify the path, then the default MATLAB installed on your computer will be used. We recommend that you specify this path so there is no ambiguity in the MATLAB installation Syndeia should use, especially if you have multiple versions of MATLAB installed.