今天嘗試在自己電腦上配置matconvnet,出現了很多莫名其妙的問題,總結記錄如下:
官網上的安裝教程如下:http://www.vlfeat.org/matconvnet/install
1、MATLAB2013不支持vs2013,所以在MATLAB command window輸入mex -setup時會提示找不到編譯器vs2013
參考網上的解決辦法:http://blog.csdn.net/gotomic/article/details/29594247
https://jingyan.baidu.com/article/1612d50044d0f2e20f1eee10.html
2、Matlab與其他軟件做接口,通常需要VC編譯器。
第一步:在Matlab的命令窗口輸入 mex -setup可以選擇VC編譯器。
但有時會出現找不到VC編譯器的情況。出現這種情況,通常有兩種原因,一種是VC編譯器比Matlab的版本新,Matlab無法識別,當然也無法使用。
還有一種情況是,Matlab未找到VC的安裝位置,出現這種情況的原因可能是Matlab和VC的安裝順序不當,或者是VC未安裝到默認地址,即C盤Program files文件夾下。
這種情況在mex -setup后,如果選擇y,提示
第二步:找不到vs2013,所以我們選擇n,手動輸入vs2013的路徑
>> mex -setup 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/R2013a/win32.html Please choose your compiler for building MEX-files: Would you like mex to locate installed compilers [y]/n? n Select a compiler: [1] Intel C++ 13.0 (with Microsoft Software Development Kit (SDK) linker) [2] Intel C++ 13.0 (with Microsoft Visual C++ 2010 linker) [3] Intel C++ 13.0 (with Microsoft Visual C++ 2012 linker) [4] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker) [5] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker) [6] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) [7] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) [8] Intel Visual Fortran 13 (with Microsoft Software Development Kit (SDK) linker) [9] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2010 linker) [10] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2012 linker) [11] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker) [12] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker) [13] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker) [14] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) [15] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) [16] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) [17] Lcc-win32 C 2.4.1 [18] Microsoft Software Development Kit (SDK) 7.1 [19] Microsoft Visual C++ 2005 SP1 [20] Microsoft Visual C++ 2008 SP1 [21] Microsoft Visual C++ 2010 [22] Microsoft Visual C++ 2012 [23] Open WATCOM C++ [0] None
第三步:選21,選n,輸入自己電腦上vs的安裝路徑

第四步:再選y,mex就完成了(到這一步,我的32位的電腦還是不成功,有毒。。。。。)
3、配置matconvnet只需運行幾步
(1)run vl_compilenn;
(2)run vl_setupnn

4、注意一個問題,每次新建一個代碼工程,都要把vlfeat和matconvnet的庫放到代碼的目錄下,寫一個setup.m文件,內容如下:
1 %2017 05 05 CLQ修改(不然會一直報錯,必須重新mex一遍才能跑) 2 run vlfeat-0.9.20/toolbox/vl_setup 3 4 if exist('vl_nnconv') ~= 3 5 run matconvnet-1.0-beta23/matlab/vl_setupnn 6 if exist('vl_nnconv') ~= 3 7 warning('MatConvNet not compiled, attempting to fix...') ; 8 copyfile(... 9 'matconvnet-1.0-beta23/matlab/src/vl_nnconv.cu', ... 10 'matconvnet-1.0-beta23/matlab/src/vl_nnconv.cpp') ; 11 mex('matconvnet-1.0-beta23/matlab/src/vl_nnconv.cpp', ... 12 'matconvnet-1.0-beta23/matlab//src/bits/im2col.cpp', ... 13 'matconvnet-1.0-beta23/matlab//src/bits/subsample.cpp', ... 14 '-Imatconvnet/matlab/src',... 15 '-lmwblas') ; 16 end 17 end

要把兩個庫文件放在exercise.m的目錄下!!!!!
