版本R2016a,在使用minmax_install工具时出现:
错误使用 getmexopts (line 36)
getmexopts [Bruno]: cannot open comopts.bat file出错 minmax_install (line 20)
compiler = getmexopts('COMPILER');
进入getmexopts函数,看到调用程序如下:
if ispc()
optpath=prefdir;
optfile=[optpath filesep 'comopts.bat'];
mexoptfile=[optpath filesep 'mexopts.bat'];
原因分析:prefdir指向了“C:\Users\*****\AppData\Roaming\MathWorks\MATLAB\R2016a”这样的路径,但是找不到comopts.bat文件,所以报错。
解决方案:在Mathwork中官方找到了解释:在Matlab2014a以后的版本就删除了comopts.bat这个文件,解决方法下载最新的minmax_install工具箱:MinMaxSelection下载,最新版在2016年针对这个问题更新过。
新旧版本对比如下:(红色部分为新版本加入的判断条件)
if ispc() && datenum(version('-date')) < datenum('January 11, 2014')
compiler = getmexopts('COMPILER');
islcc = strcmpi(compiler,'lcc');
如果检测到版本在2014之后,就不会执行下面的getmexopts调用。用最新的工具箱就没问题了。