MATLAB Answers

0

index matrix exceeds dimensions ?! svm

Asked by Kamal Ebrahimi on 2 Dec 2018
Hello , i'm new to matlab trying to write simpler code based on svm fisheriris
i'm writing for simple data whcih is phone detector by having 12 phone as a data.
i'm gettig error regarding dimesnsion in last 4 lines of my code ,and i don't see my index matrix has any problem!!! i'll be grateful if someone helps
%%prepare data set
load pashmak
species_num = grp2idx(species); % converting data phone type to number set
X=meas(1:12.); y=species_num(1:12.);
%writing code to create train data data
trainx=(200:0.5:450) ;
x=cell(1,100);
for j=1:100
x{1,j}=trainx(randi([1 numel(trainx)],1));
end
cell2mat(x) % 100 test data has been made
trainy=(1:1:12) ;
yb=cell(1,100);
for j=1:100
yb{1,j}=trainy(randi([1 numel(trainy)],1));
end
cell2mat(yb) % 100 test data has been made
ran=randperm(100);
X_train = x(ran(1:80),:);
y_train = yb(ran(1:80),:);
X_test = x(ran(81:end),:);
y_test = yb(ran(81:end),:);

  0 Comments

Sign in to comment.

0 Answers