Qury for SVM classifier : svmtrain function

1 Ansicht (letzte 30 Tage)
hamed abdulaziz
hamed abdulaziz am 20 Apr. 2014
Kommentiert: Isra Anwar am 18 Apr. 2016
I want to use SVMStruct = svmtrain(Training,Group) for two classes (Noraml and Abnormal)images classification purpose,and the size of the Training matrix is 1*40 cells each cell is 75 rows * 10 columns so I want to give this Training matrix to the svmtrain function but after calling the svmtrain function I got this error :
*Error using svmtrain (line 241)
TRAINING must be a numeric matrix*
Could anyone guide how to correct this error,because I am really stuck in that error,thank you.
The following are code lines what I tried :
clc
clear all;
close all;
%% After creating them in another section of code this section for loading two training matrices
load('norGlobal_matrix_train_variablek10bin25md.mat')
load('abGlobal_matrix_train_variablek10bin25md.mat')
counter_im=1;
[row ,col]=size(norGlobal_matrix_train_variablek10bin25md);
for i=1:10:row temp=norGlobal_matrix_train_variablek10bin25md(i:i+9,1:end);
trasposed_temp=temp';
normal_features {counter_im} =trasposed_temp;
traininglabel{counter_im}=1 ;
counter_im=counter_im+1;
end
svm=svmtrain(normal_features{:}, traininglabel{:});

Antworten (1)

Ping-Chang Shih
Ping-Chang Shih am 29 Sep. 2014
Since the two training matrices are not attached to this question, the only conjecture I could make is some elements in "norGlobal_matrix_train_variablek10bin25md" are not numeric variables. An easy test can be perform to test if all elements in "normal_features" are numeric values: You can use
isnumeric([normal_features{:}]);
If this function returns 1, then all elements in normal_features are numeric. Please note that "normal_features{:}" is wrapped in brackets because "normal_features{:}" itself returns multiple arguments, but function "isnumeric" only takes one argument as input.
If this does not answer your question, please attach the "MAT" files required to execute the code.
  1 Kommentar
Isra Anwar
Isra Anwar am 18 Apr. 2016
Even I am facing the same issue. The size of the Training matrix is 40*1 cells each cell is 200*1 so I want to give this Training matrix to the svmtrain function but after calling the svmtrain function I got this error: Error using svmtrain (line 241) TRAINING must be a numeric matrix.
I have also attached my mat file.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by