can someone help me with this svmtrain's error "Error using svmtrain ,TRAINING must be a numeric matrix"?

1 次查看(过去 30 天)
I am trying to figure out why i am seeing this error but i am stuck, here is the code:
[X,T] = catadataset;
xdata = X;
group = T;
svmStruct1 = svmtrain(xdata,group,'kernel_function');
species = svmclassify(svmStruct1,feat,'showplot',false)
catadataset:
function [X,T] = catadataset
datastruct_x = load('csvlistall.mat');
X = datastruct_x;
datastruct_t = load('cata_Label1.mat');
T = datastruct_t;
end
csvlistall.mat is a 88X95 matrix, and it contains only numbers ,cata_Label1.mat is a 1X95 matrix and also contains only numbers. can somebody help me please?
  2 个评论
Walter Roberson
Walter Roberson 2016-10-18
Please show class(X), class(T)
Because you are loading from a .mat file, there is the possibility that the .mat file is a true binary .mat file instead of being a text file. A binary .mat file would return a struct() from load() rather than a numeric matrix, even if the .mat file only contains one variable.
It might end up looking something like
function [X,T] = catadataset
datastruct_x = load('csvlistall.mat');
X = datastruct_x.csvlistall;
datastruct_t = load('cata_Label1.mat');
T = datastruct_t.cata_Label1;
end
Hadeer tawfik
Hadeer tawfik 2016-10-18
yes this is true, it was a true binary .matfile, so I have changed the code into yours and it has worked perfectly , thank you so much

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by