MATLAB: How to setup Visual Studio Professional 2013 as the compiler for mex -setup Matlab 2015b

MATLABMATLAB Compilermex compilerSimulink Real-Time

I have installed Visual studio 2013 professional but when I run mex -setup -v it shows that it is not found. What should I do to make Matlab see that it has been installed? I have read several other answers but they didn't help me.
I do have mingw c++ compiler but I specifically need visual studio professional as it is a prerequisite for another software I am using interfaced with Matlab.
Also, does the problem exist because Visual studio I have is 32 bit whereas my laptop is 64 bit? Just wanted to confirm.
Verbose mode is on.
... Looking for compiler 'Intel C++ Composer XE 2011 with Microsoft SDK 7.1 (C)' ...
... Looking for environment variable 'ICPP_COMPILER12' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2011 with Microsoft SDK 7.1 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2008 (C)' ...
... Looking for environment variable 'ICPP_COMPILER12' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2008 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2010 (C)' ...
... Looking for environment variable 'ICPP_COMPILER12' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2010 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft SDK 7.1' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft SDK 7.1'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2010 (C)' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2010 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012 (C)' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012 (C)'.
... Looking for compiler 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\MATLAB\SupportPackages\R2015b\MW_MinGW_4_9').
... Looking for file 'C:\MATLAB\SupportPackages\R2015b\MW_MinGW_4_9\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\MATLAB\SupportPackages\R2015b\MW_MinGW_4_9\' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
... Looking for compiler 'Microsoft Visual C++ 2008 (C)' ...
... Looking for environment variable 'VS90COMNTOOLS' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2008 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2010 (C)' ...
... Looking for environment variable 'VS100COMNTOOLS' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2010 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2012 (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 11.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2012 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2013 Professional (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 12.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl.exe' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...Yes ('C:\Program Files (x86)\Windows Kits\8.1\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 12.0\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 12.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\').
... Looking for environment variable 'VS120COMNTOOLS' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2013 Professional (C)'.
... Looking for compiler 'Microsoft Visual C++ 2015 Professional (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2015 Professional (C)'.
... Looking for compiler 'Microsoft Windows SDK 7.1 (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.1' InstallationFolder ...No.
Did not find installed compiler 'Microsoft Windows SDK 7.1 (C)'.
... Looking for compiler 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\MATLAB\SupportPackages\R2015b\MW_MinGW_4_9').
... Looking for file 'C:\MATLAB\SupportPackages\R2015b\MW_MinGW_4_9\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\MATLAB\SupportPackages\R2015b\MW_MinGW_4_9\' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.

Best Answer

My bad!!! I just had to restart Matlab to get it working. A really silly mistake I guess.
Related Question