필터 지우기
필터 지우기

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