This is to make that block the RunTime Object. Note the input(s) and outputs.ĥ) Change the path of the MATLAB to the location of the GetRealTimeData.m or set the path.Ħ) Click on the SubSystem block in the sc_user_interface block of the Simulink. This is the file that we are calling from python. You might have to do this in MATLAB command line too.Ĭd (fullfile(matlabroot,'extern','engines','python'))Ģ) Second type in the MATLAB command window to share the currently opened MATLAB instance.Ĥ) Open the GetRealTimeData.m file in the same MATLAB window to see what it does. (type matlabroot in MATLAB command window to get the directory) Install the MATLAB agent using the following lines in Anaconda: If you are using Anaconda then use the following code in the Anaconda Command Line to create a new environment (if required).Ĭonda create -n "myenv" python=3.6 ipython If you are using a later version of MATLAB then you can use python 3.7.
MATLAB agent of 2018b version requires python 3.6. Simulink model should run in MATLAB 2018b or a later version. I commented out the blocks from the ARTEMis library. The Simulink model is created to run in OPAL-RT real-time digital simulator.
The attached Simulink model is based on this:
#WHAT PATH SETTINGS DOES MATLAB 2018B REQUIRE HOW TO#
The attached files show how to send/receive Simulink data using python while the simulation is running.