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!