Azzera filtri
Azzera filtri

Index in position 2 exceeds array bounds

1 visualizzazione (ultimi 30 giorni)
Muhammad Izz Irfan
Muhammad Izz Irfan il 28 Dic 2020
Commentato: Jan il 30 Dic 2020
How i want to solve this kind of problem ? I got an error Index in position2 exceeds array bounds
Error in RunMCSVMClassifier4 (line 20)
result = zeros(length(Xtest(:,1)),1);
function [err,M] = RunMCSVMClassifier4(Xtrain,Ytrain,Xtest,Ytest)
u=unique(Ytrain);
numClasses=length(u);
result = zeros(length(Xtest(:,1)),1);
models=[];
for k=1:numClasses
G1vAll=double(Ytrain==u(k));
models{k} = fitcsvm(Xtrain,G1vAll,'Standardize',true,....
'KernelFunction','RBF','KernelScale','auto');
end
%classify test cases
for j=1:size(Xtest,1)
for k=1:numClasses
if(predict(models{k},Xtest(j,:)))
break;
end
end
result(j) = k;
end
err=1-(sum(Ytest==result)/length(result));
if(nargout>1)
M=confusionmat(Ytest,result);
end
end
  1 Commento
Jan
Jan il 30 Dic 2020
Please post a complete copy of the error message, such that the readers do not have to guess, where the problem occurs.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by