Matlab keeps calling the wrong SVMtrain function

2 ビュー (過去 30 日間)
Premal
Premal 2015 年 1 月 10 日
回答済み: Abdul Ghaffar 2019 年 7 月 20 日
Hi, I have a question about the svm train function. I have installed and done the make files using libsvm from the following website http://www.csie.ntu.edu.tw/~cjlin/libsvm/
However, when I call the function it gives me the following error in the files provided: Error using svmtrain (line 233) Y must be a vector or a character array.
Error in SVR_load_ver2 (line 107) model = svmtrain(lrndata.y, lrndata.X, param.libsvm);
After doing some research I realized that the statistics toolbox has a different svmtrain function with the same name and that is the one that was being called. I already have the libsvm files at the top of my paths.
Any possible solution would be greatly appreciated!
Thank you!!
  2 件のコメント
mehrose
mehrose 2015 年 8 月 18 日
run the following command, you will find out which function is calling.
which -all svmtrain
then remove the lib you have added for svm. from the command line, add the path of your svm lib.
addpath your_lib_name
run the file. if the problem exists, try downloading the new version of lib, and try again. i have lib libsvm-mat-2.88-1. it doesnt work. i downloaded libsvm-3.20 with the above steps, it works!
Tung Nguyen
Tung Nguyen 2016 年 11 月 27 日
Hi, I tried to addpath to a folder that contains my *.mexa64 files. But, Matlab keeps calling the default svmtrain.m file. I also tried to change the file name (svmtrain.m -> svmtrain_temp.m), and Matlab response:
Previously accessible file "/usr/local/MATLAB/R2016b/toolbox/stats/stats/svmtrain.m" is now inaccessible.
How can I force Matlab to choose the svmtrain in my .mex files?

サインインしてコメントする。

回答 (4 件)

the cyclist
the cyclist 2015 年 1 月 11 日
You can use the path command to see and change the path, which will determine which version of the function is "seen" first, and used.

the cyclist
the cyclist 2015 年 1 月 11 日
You can use
which -all svmtrain
to identify all the instances of this function, and specify the complete path to the one you want, not relying on MATLAB's priority. This can be a bit cumbersome, though.

Mubashir
Mubashir 2018 年 8 月 16 日
Just copy the 'svmtrain' function from LibSvm Matlab folder to your folder, from which you are calling a function. This works with my same problem.

Abdul Ghaffar
Abdul Ghaffar 2019 年 7 月 20 日
@all. I am also facing the same problem in 'svmtrain '.
"Error using svmtrain (line 230)
svmtrain has been removed. Use fitcsvm instead."
Please guide me how to resolve this issue.
I just download and can't do make files using libsvm from the following website http://www.csie.ntu.edu.tw/~cjlin/libsvm/

カテゴリ

Help Center および File ExchangeDownloads についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by