[/size][/backcolor][size=12px]data = [176 70;[/size][/color][color=#999999][size=12px]180 80;[/size][/color]
[color=#999999][size=12px]161 45;[/size][/color]
[color=#999999][size=12px]163 47];[/size][/color]
[color=#999999][size=12px]label = [1;1;-1;-1];[/size][/color]
[color=#999999][size=12px]
[/size][/color]
[color=#999999][size=12px]model = svmtrain(label,data);[/size][/color]
[color=#999999][size=12px]
[/size][/color]
[color=#999999][size=12px]testdata = [190 85];[/size][/color]
[color=#999999][size=12px]testdatalabel = -1;[/size][/color]
[color=#999999][size=12px]
[/size][/color]
[color=#999999][size=12px][predictlabel,accuracy] = svmpredict(testdatalabel,testdata,model);[/size][/color]
[color=#999999][backcolor=rgb(242, 242, 242)][size=12px]
Error using svmtrain (line 233)
Y must be a vector or a character array.

 Accepted Answer

0 votes

解决方法:
1.点击Matlab左上角的file,选择set path
2.在弹出的选项框中,选择第二个选项And with Subfolders
3.找到你的libsvm文件夹,点确定
4.点击save,关闭set path
OK

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!