最关键的是compilers的选择(对于把Microsoft visual stdio 2005或者其他的编译器安装在自定义目录下的这一步非常关键)  以下是步骤:
>> mex -setup % 这是必须的
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? %这次选择13,或许你也可以用其他的
The default location for Microsoft Visual C++ 2005 compilers is C:\Program Files\Microsoft Visual Studio 8, 
but that directory does not exist on this machine.

Use C:\Program Files\Microsoft Visual Studio 8 anyway [y]/n? n %这次它说要使用默认的路径  继续选择n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio 8] %它的意思是让你输入编译器的位置,输入:D:\Program Files\Microsoft Visual Studio 8
% 下面就是确认了
Please verify your choices:

Compiler: Microsoft Visual C++ 2005  
Location: D:\Program Files\Microsoft Visual Studio 8

Are these correct?([y]/n): y
*************************************************************************** 
  Warning: MEX-files generated using Microsoft Visual C++ 2005 require 
           that Microsoft Visual Studio 2005 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. 
           You can find more information about this at: 
           http://www.mathworks.com/support/solutions/data/1-2223MW.html 
***************************************************************************

Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2007a\mexopts.bat 
From template:              D:\PROGRA~2\MATLAB\R2007a\bin\win32\mexopts\msvc80opts.bat

Done . . . %   ok,done!
>> make
>> 
%至此彻底完成,
%以下是测试
>>load heart_scale.mat
>>model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07');
>> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model); % 
Accuracy = 86.6667% (234/270) (classification)%  done

这个帖子很完整的讲了如何使用mex命令安装libsvm。但是当你看完这个帖子之后,你可能还是无法安装成功(比如我之前就因为无法安装而发帖求助),下面我来补充一下在学会使用mex命令之后可能会出现的问题。
第一:无法找到compiler
>> make
  Error: Could not find the compiler "cl" on the DOS path. 
         Use mex -setup to configure your environment properly.

E:\BIN\MEX.PL: Error: Unable to locate compiler.

这是因为你的电脑里没有vc编译器(compiler)或者你没有把vc编译器的路径指定正确。遇到这种情况大家可能会直接复制
Select a compiler: 
[1] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[2] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) 
[4] Lcc-win32 C 2.4.1 
[5] Microsoft Visual C++ 6.0 
[6] Microsoft Visual C++ 2005 SP1 
[7] Microsoft Visual C++ 2008 SP1 
[8] Microsoft Visual C++ 2010 
[9] Microsoft Visual C++ 2010 Express 
[10] Open WATCOM C++ 
这里的某个选项的名称,去百度,然后下载 ,然后发现安装,然后运行 make,然后依然失败。你发现,你在“添加删除程序里”可以找到Microsoft Visual C++ 2005 SP1 ,但是,你没办法找到它的位置。
这是因为你下载的不是编译器(compiler)而是运行库!!!!!请注意,如果你没有compiler,那么请下载visual studio 系列,比如visual studio 2010,这才是编译器。visual studio都比较大,通常2G多,如果你下载的只有几M,那么你下载的可能不是编译器。

第二,安装了visual  studio,libsvm依然无法安装。
这可能是你的visual studio版本过低的缘故。类似问题可能出现在win7用户上。本人的matlab版本也比较高(matlab 2010b)之前用visual studio 2008,在warning的提示里显示,有两个tools没有按规格安装,大概意思就是不适合64为的系统,于是我删除了vs 2008,下载了vs 2010。这样安装libsvm就成功了。
在这里,我强烈建议,如果你系统是win7,如果你的matlab是2010b及更高版本,那么请使用visual studio 2010及更高版本的编译器。

第三,如何知道我的libsvm安装成功了呢?
(1)make之后没有报错就成功来了
(2)其实make的过程就是创建matlab可以识别的新文件的过程,当你打开libsvm 3.1的文件夹,同时你运行make,你会发现,原有类型为C Source的文件下,生成了类型为MEXW64的新文件。
(3)当然,可能你没有注意到这个过程,更直白的方法是运行这两个命令,看看是否可以运行(如:再论Matlab的libsvm的安装中讲的一样):
>>model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07');
>> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model);
但是你发现无法load heart_scale.mat,比如http://www.ilovematlab.cn/thread-144063-1-1.html
那是因为在这个libsvm3.1的工具箱里没有heart_scale这个数据集,再论Matlab的libsvm的安装里用的是另一个版本的libsvm,那个文件夹里是有这个数据集的,所以他可以load之后,运行上面的两个命令,所以,各位可以下载其他版本的libsvm,里面有这个heart_scale,mat,安装完libsvm3.1之后,file——open——找到heart_scale.mat,打开,然后你workspace里就有这个数据集了,之后你才可以运行
>>model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07');
>> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model);

第四,我的matlab里有svmtrain啊!!
的确,你的matlab里有svmtrain这个函数,你运行 help svmtrain 之后可以研究一下它的用法,但这个svmtrain是matalb自带的,不是libsvm里的。
如果你购买的是《matlab神经网络30个案例分析》那么你在运行12章程序的时候会发生如下问题
??? Error using ==> svmtrain at 172
Group must be a vector
你安装libsvm之后,在libsvm工具箱之下运行matlab,这时你使用的才是libsvm工具箱。这时你打开12章的那个数据集,然后你的workspace里有了相应数据之后,再运行12章的程序,才能顺利运行。运行结果是:
optimization finished, #iter = 77
nu = 0.144033
obj = -9.505833, rho = 0.384005
nSV = 37, nBSV = 0
*.*
optimization finished, #iter = 61
nu = 0.105301
obj = -5.580687, rho = 0.054779
nSV = 32, nBSV = 0
.*
optimization finished, #iter = 90
nu = 0.198508
obj = -11.897346, rho = -0.318369
nSV = 44, nBSV = 1
Total nSV = 66
Accuracy = 97.7528% (87/89) (classification)
安装了libsvm之后运行成功。

希望以上内容可以对大家有帮助!

Matlab的libsvm的安装的更多相关文章

  1. 64位matlab中libsvm的安装

    因为windows版的matlab对编译器的识别不好.所以直接在网上下了已经编译好的libsvm文件放入toolbox文件夹就可以用libsvm了 libsvm已编译好的文件下载地址: 猛戳我下载 1 ...

  2. 学习笔记24—win10环境下python版libsvm的安装

    1.前言 由于毕业设计需要用到libsvm,所以最近专心于配置libsvm,曾经尝试过在matlab中安装,但是没有成功.最终在Python环境中完成安装. 2.LIBSVM介绍 LIBSVM 是台湾 ...

  3. matlab怎么查看已安装哪些工具箱和…

    问题描述:matlab怎么查看已安装哪些工具箱和它们相应的版本 解决方法:在命令行里敲击der,回车 效果:

  4. Anaconda 下libsvm的安装

    方法一. 利用VS生成动态库的安装    详细可参考这篇博文进行操作:https://blog.csdn.net/jeryjeryjery/article/details/72628255 方法二. ...

  5. libSVM在matlab下的使用安装

    1) 从LIBSVM的官网http://www.csie.ntu.edu.tw/~cjlin/libsvm/上下载最新版本的LIBSVM,当前版本为libsvm-3.18.zip 2) 解压压缩包到电 ...

  6. matlab使用libsvm入门教程——使用matlab安装配置libsvm以及一个svm分类实例

    前言 此教程专注于刚入门的小白, 且博客拥有时效性, 发布于2019年3月份, 可能后面的读者会发现一些问题, 欢迎底下评论出现的问题,我将尽可能更新解决方案. 我开始也在如何安装libsvm上出现了 ...

  7. 【matlab】libsvm-3.18安装与使用

    安装 1. 在http://www.csie.ntu.edu.tw/~cjlin/ 中下载libsvm 2. 按照http://zjhello123.blog.163.com/blog/static/ ...

  8. paper 21 :Libsvm的安装和使用

    看了很多资料(包括我们实验室群里师兄上传的资料),算是掌握了libsvm的正确安装和使用,把结果告诉大家以方便以后使用. 1. 参考网站: libsvm库下载:http://www.csie.ntu. ...

  9. matlab配置Libsvm 防止备忘录

    1 首先我们要下载一个Libsvm 工具箱 其中,这一切都可以被下载到 2 我们解包 我解压在桌面上 住址C:\Users\Administrator\Desktop\libsvm 3打开matlab ...

随机推荐

  1. docker operation method note

    docker stop script #!/bin/bash CID_LIST=$(docker ps -q | xargs)if [ "$CID_LIST" = "&q ...

  2. escape()、encodeURI()、encodeURIComponent() difference

    escape() 方法: 采用ISO Latin字符集对指定的字符串进行编码.所有的空格符.标点符号.特殊字符以及其他非ASCII字符都将被转化成%xx格式的字符编码(xx等于该字符在字符集表里面的编 ...

  3. javascript 判断浏览器的ie版本,替换html标签

    /* var browser=navigator.appName var b_version=navigator.appVersion var version=b_version.split(&quo ...

  4. WebDriver 随笔

    在webDriver中通过 driver.findElement进行定位元素时,往往是从页面的上到下依次寻找,根据该等位方式寻找到第一个元素. driver.findElement(By.id())有 ...

  5. strcpy  复制字符串函数

    #include<stdio.h> #include<assert.h> char *strcopy(char * strDest , const char * strSrc) ...

  6. 反射认识_03_改变成员变量Fields

    包01:package ReflectionChange; public class ReflectionPoint_AB { String str1="access"; Stri ...

  7. demo07

    city_data.xml <?xml version="1.0" encoding="utf-8"?> <resources> < ...

  8. u盘安装centos

    1. 下载centos系统2. 使用UltraISO制作u盘启动.制作方法:http://jingyan.baidu.com/article/a378c960630e61b329283045.html ...

  9. delphi 读取excel 两种方法

    http://www.cnblogs.com/ywangzi/archive/2012/09/27/2705894.html 两种方法,一是用ADO连接,问题是Excel文件内容要规则,二是用OLE打 ...

  10. ios学习笔记(一)Windows7上使用VMWare搭建iPhone开发环境(转)

    原文地址:http://blog.csdn.net/shangyuan21/article/details/18153605 我们都知道开发iPhone等ios平台的移动应用时需要使用Mac本,但是M ...