Make sure that you have installed a C++ compiler that is compatible with the version of MATLAB you are using. You can check the system requirements for your version of MATLAB to ensure compatibility.

Set the environment variable “MW_MINGW64_LOC” to the location of the C++ compiler. You can do this by running the following command in the MATLAB Command Window:

 

setenv('MW_MINGW64_LOC', 'C:\path\to\compiler')

Replace ”

C:\path\to\compiler

” with the actual path to the C++ compiler installation directory.

Try running the ”

mex -setup

 

>> mex -setup


MEX configured to use ‘MinGW64 Compiler (C)’ for C language compilation.

To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN

 

>> mex -setup C++

MEX configured to use ‘MinGW64 Compiler (C++)’ for C++ language compilation.