I solved this problem completely. I want to explain.
* Windows 10
* System type: 64-bit
* Matlab 2021a
Do the following steps
You can get help from this websites for installation :
# You should pay attention to use the VPN during installation so that the package is completely downloaded and installed.
2. After installation, you need to add the path to the Environment Variables.
Adding path to User Variables
Adding path to System Variables
3. Download MinGW 6.3 :
You can get help from this websites for installation :
4. Now, in order to find out that the system recognizes the compiler correctly, we must type the following line in Command Prompt. And we should have such an output.
gcc --version
or
g++ --version
5. Create the environment variable MW_MINGW64_LOC in System Variables with the second MinGW 6.3 like this
6. Download the attached MATLAB function "configuremingw" from the following website and place it in the MATLAB folder.
run command configuremingw in matlab and choose folder
C:\mingw-w64\x86_64–6.3.0-posix-seh-rt_v5-rev2\mingw64
7. Restart MATLAB and then call 'mex -setup' in MATLAB in order to check and configure MinGW. The output should show something like:
"MEX configured to use 'MinGW64 Compiler (C)'..."
8. Next, we can use MATLAB Help to test the example