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
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 Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by