When installing the MinGW compiler, the environment variable MW_MINGW64_LOC is set with the path to the MinGW installation folder. On some systems where users have limited privileges, there may be policies in place preventing environment variables from being set. If this environment variable is not staying set following the installation, or after restarting MATLAB, the behavior described above may occur.
Running the 'mex -setup' command in verbose mode
will display whether the MW_MINGW64_LOC environment variable is set. If this is not the case, the output will look as shown below:
The solution is to have an administrator set the environment variable on your system. Your local IT administrator should be able to help with this. On Windows 10, you can find this panel by entering "Edit the system environment variables" in the Windows search:
The environment variable should have the following name and value:
- Variable Name: MW_MINGW64_LOC
- Variable Value: <SupportPackageRoot>\3P.instrset\mingw_w64.instrset
where <SupportPackage Root> is the output received for the command: