MATLAB Answers

Can I use Microsoft Visual Studio 2019 with MATLAB R2019a or R2018b?

485 views (last 30 days)
Can I use Microsoft Visual Studio 2019 with MATLAB R2019a or R2018b?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Apr 2019
You can use VS 2017 but not VS 2019 at this time.

  4 Comments

Show 1 older comment
Walter Roberson
Walter Roberson on 21 May 2019
You would need to contact Mathworks Sales to get information about forthcoming plans. Everything I know about future plans is under NDA (Non-Disclosure Agreement.)
Royi Avital
Royi Avital on 25 May 2019
Usually you can do some manual tricks to add support. One needs to look for other posts in the forum to see how to do it.

Sign in to comment.

More Answers (2)


Royi Avital
Royi Avital on 25 May 2019
Edited: Royi Avital on 25 May 2019
I'm not sure how the search for Compiler works for the mex command.
From 5 minutes research I did I came to the conclusion it works as following:
  • It goes through each xml file in C:\Program Files\MATLAB\R2018b\bin\win64\mexopts.
  • Each xml file define places to look and priority (In case you have more than 1).
  • The search goes by priority and set the compiler it finds with the highest priority among all those found.
Once it finds a compiler it creates an xml file named C:\Users\<UserName>\AppData\Roaming\MathWorks\MATLAB\R2018b\mex_C_win64.xml.
Now, in MATLAB R2018b and probably R2019a you have files searching for VS 2017 but not for 2019.
I took msvc2017.xml and msvcpp2017.xml renamed them to msvc2019.xml and msvcpp2019.xml. I edited their content for what I think would be right for Visual Studio 2019. Basically updating version number from 15.0 to 16.0.
I attached a zip file witho those to the answer.
I think if you copy them into C:\Program Files\MATLAB\R2018b\bin\win64\mexopts\ and run mex -v -setup it should work.

  2 Comments

Rody Oldenhuis
Rody Oldenhuis on 30 May 2019
On R2019a, there's still no official support. This solution -almost- worked; I had to add a REG_SZ to the registry at:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7
with content:
Name: 16.0
Value: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\
After that, everything worked like a breeze.
Royi Avital
Royi Avital on 8 Aug 2019
I thought that would be something added by VS 2019 setup. What key does VS 2019 add?

Sign in to comment.

Sign in to answer this question.


Translated by