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!