matlab2013a安装libsvm3.21

废话不说,直接正题  配置环境  matlab2013a+libsvm3.21


libsvm下载地址:http://www.csie.ntu.edu.tw/~cjlin/libsvm/

压缩包下载后放在MATLAB文件夹下toolbox文件夹


步骤1:设置path


add with subfolders->加入libsvm-3.21文件夹的路径

步骤2:mex -setup

设置路径(即matlab窗口左侧路径)为libsvm-3.21文件夹下matlab文件夹,在common  window中输入mex -setup (注意字母“x”后边有一个空格)回车

显示:

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/win64.html 

如果没有添加空格会显示:

  Usage: 
        MEX [option1 ... optionN] sourcefile1 [... sourcefileN] 
            [objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN] 
 
    Use the -help option for more information, or consult the MATLAB API Guide. 
 
 
  C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: No file names given. 
 
Undefined function or variable 'setup'.


步骤3:选择编译器

mex -setup之后会出现让你选择一个编译器

Please choose your compiler for building MEX-files: 
 
Would you like mex to locate installed compilers [y]/n?

写y然后回车

出现:

Select a compiler: 
[1] Microsoft Visual C++ 2010 in c:\Program Files (x86)\Microsoft Visual Studio 10.0 
 
[0] None 

在这里只需要选择一个C++的编译器即可,我只有装了一个vs2010,所以这里填写 “1”回车

出现让你再确认一下路径,填写“ y ”

出现两行警告信息,不用管,警告信息如下

*************************************************************************** 
  Warning: MEX-files generated using Microsoft Visual C++ 2010 require 
           that Microsoft Visual Studio 2010 run-time libraries be  
           available on the computer they are run on. 
           If you plan to redistribute your MEX-files to other MATLAB 
           users, be sure that they have the run-time libraries. 
*************************************************************************** 
 
 
Trying to update options file: C:\Users\paul\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat 
From template:              C:\PROGRA~1\MATLAB\R2013a\bin\win64\mexopts\msvc100opts.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. 
************************************************************************** 

步骤4:编译

在common window输入“make”,很多同学在这里会遇到问题,提示出现:

LINK : fatal error LNK1104: 无法打开文件“libsvmread.mexw64” 
 
  C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Link of 'libsvmread.mexw64' failed. 
 
Error: C:\Program Files\MATLAB\R2013a\toolbox\matlab\general\mex.m failed (line 206)
Unable to complete successfully.
=> Please check README for detailed instructions.

这个错误,这个错误不是没有解决办法,网上有的帖子说让进入windows文件夹下复制文件进matlab文件夹,最好不要这样,这个错误出现的问题应该是matlab程序没有取得管理员权限,不能在program files文件夹下添加文件,所以我们的解决办法是退出matlab程序,打开matlab程序时选用使用管理员权限打开matlab这样在common window输入“make”就可以正常编译出64位文件了,如下图所示:


新增的文件如当前文件夹所示,这样就基本成功了


步骤5:测试安装是否成功

网上很多帖子说使用libsvm目录下的heart_scale数据进行验证,我们输入load heart_scale之后会出现:

Error using load
Number of columns on line 3 of ASCII file C:\Program
Files\MATLAB\R2013a\toolbox\libsvm-3.21\heart_scale must be the same as previous
lines.

这里这个文件是有问题的,我们下载的相信版本的libsvm文件夹中的heart_scale文件是C++格式的

这里提供一个matlab版本的heart_scale文件: http://download.csdn.net/detail/u010970698/9498254

下载文件后将此文件放在matlab文件夹下,在common window中输入load heart_scale 即可看到workspace显示:



这样就证明安装成功

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值