[Matlab]MinmaxSelection工具箱“cannot open comopts.bat file”

版本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調用。用最新的工具箱就沒問題了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章