can someone help me with this svmtrain's error "Error using svmtrain ,TRAINING must be a numeric matrix"?
3 次查看(过去 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
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
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!