matlab 调用mex -setup问题

来源:互联网 发布:网络计划图计算 编辑:程序博客网 时间:2024/05/17 10:39

装了visual studio 2015,可是在matlab中调用失败了。

>> mex -setupError using mexNo supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2015a/win64.html.

尝试去装SDK,还是不行。下面介绍一个可行的方法,也许对你有用。

下载gnumex,地址:https://sourceforge.net/projects/gnumex/?source=typ_redirect
下载Rtools,一个开发R语言的工具,地址:https://cran.r-project.org/bin/windows/Rtools/,下载好后安装。
下载Cygwin,地址:https://www.cygwin.com/,下载好后安装。
将gnumex解压到matlab目录下,并将matlab的目录切换到该文件的主目录下。在matlab的命令行中输入:

>> gnumex

会弹出一个GUI 框:
这里写图片描述

安装图中的选择好目录,最后点击Make options file,稍作等待几分钟,就OK了。

看结果:

>> mex -setupWarning: Legacy MEX infrastructure is provided for compatibility; it will be removed in a futureversion of MATLAB. For more information, consult the MEX release noteshttp://www.mathworks.com/help/matlab/release-notes.html. Welcome to mex -setup.  This utility will help you set up  a default compiler.  For a list of supported compilers, see  http://www.mathworks.com/support/compilers/R2015a/win64.html Please choose your compiler for building MEX-files: Would you like mex to locate installed compilers [y]/n? ySelect a compiler: [1] gcc in D:\Rtools\GCC-46~1.3\bin [0] None Compiler: 1Please verify your choices: Compiler: gcc  Location: D:\Rtools\GCC-46~1.3\bin Are these correct [y]/n? yTrying to update options file: C:\Users\mingzi\AppData\Roaming\MathWorks\MATLAB\R2015a\mexopts.bat From template:              F:\matlab\bin\win64\mexopts\GNUMEXOPTS.bat Done . . . **************************************************************************   Warning: The MATLAB C and Fortran API has changed to support MATLAB            variables with more than 2^32-1 elements.  In the near future            you will be required to update your code to utilize the new            API. You can find more information about this at:            http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html             Building with the -largeArrayDims option enables the new API. ************************************************************************** 

上面有些地方需要做出选择,根据情况来选择即可。

0 0
原创粉丝点击