前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >matlab 调用mex -setup问题

matlab 调用mex -setup问题

作者头像
努力在北京混出人样
发布2019-02-18 15:36:12
1.9K0
发布2019-02-18 15:36:12
举报

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

>> mex -setup
Error using mex
No 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 -setup
Warning: Legacy MEX infrastructure is provided for compatibility; it will be removed in a future
version of MATLAB. For more information, consult the MEX release notes
http://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? y

Select a compiler: 
[1] gcc in D:\Rtools\GCC-46~1.3\bin 

[0] None 

Compiler: 1

Please verify your choices: 

Compiler: gcc  
Location: D:\Rtools\GCC-46~1.3\bin 

Are these correct [y]/n? y

Trying 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. 
************************************************************************** 

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年12月08日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档