1. Version
System: Win10
matlab version: 2023a
webots version: R2020b
2. Install MATLAB MinGW-w64 C/C++ Compiler
Before using matlab to write a controller, you need to install MATLAB MinGW-w64 C/C++ Compiler for matlab, because matlab needs to interact with c.
Download address
https://ww2.mathworks.cn/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-cc-compiler
After downloading MATLAB MinGW-w64 C/C++ Compiler, open matlab
Install
3. Configure environment variables
Add your own matlab and webots installation paths to the system environment variables accordingly. My setup looks like this:
1st
2nd
3rd
4. Test
Open the case "WEBOTS_HOME/projects/languages/matlab/worlds/e-puck_matlab.wbt" that comes with webots
file>open sample world
and click OK.
Select the matlab controller
and click run
. The appearance of this means that the test is successful, and matlab and webots can achieve joint debugging.