index matrix exceeds dimensions ?! svm
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!