概述
load('video_caadis_15.mat')
predict_labelkk=[];predict_labelnn=[];predict_labelbb=[];testlabels=[];
data1=video_caadis_15(1:184,:);
data2=video_caadis_15(185:368,:);
data3=video_caadis_15(369:552,:);
data4=video_caadis_15(553:736,:);
data5=video_caadis_15(737:920,:);
data6=video_caadis_15(921:1104,:);
data7=video_caadis_15(1105:1288,:);
data8=video_caadis_15(1289:1472,:);
data9=video_caadis_15(1473:1656,:);
data10=video_caadis_15(1657:1840,:);
data11=video_caadis_15(1841:2024,:);
data12=video_caadis_15(2025:2208,:);
data13=video_caadis_15(2209:2392,:);
data14=video_caadis_15(2393:2576,:);
data15=video_caadis_15(2577:2760,:);
for u=1:30
a=randperm(184);
dt1=data1(a,:);
dt2=data2(a,:);
dt3=data3(a,:);
dt4=data4(a,:);
dt5=data5(a,:);
dt6=data6(a,:);
dt7=data7(a,:);
dt8=data8(a,:);
dt9=data9(a,:);
dt10=data10(a,:);
dt11=data11(a,:);
dt12=data12(a,:);
dt13=data13(a,:);
dt14=data14(a,:);
dt15=data15(a,:);
dat1=dt1(1:138,:);
dat2=dt2(1:138,:);
dat3=dt3(1:138,:);
dat4=dt4(1:138,:);
dat5=dt5(1:138,:);
dat6=dt6(1:138,:);
dat7=dt7(1:138,:);
dat8=dt8(1:138,:);
dat9=dt9(1:138,:);
dat10=dt10(1:138,:);
dat11=dt11(1:138,:);
dat12=dt12(1:138,:);
dat13=dt13(1:138,:);
dat14=dt14(1:138,:);
dat15=dt15(1:138,:);
traindata=[dat1;dat2;dat3;dat4;dat5;dat6;dat7;dat8;dat9;dat10;dat11;dat12;dat13;dat14;dat15];
train_data= traindata';
daat1=dt1(139:184,:);
daat2=dt2(139:184,:);
daat3=dt3(139:184,:);
daat4=dt4(139:184,:);
daat5=dt5(139:184,:);
daat6=dt6(139:184,:);
daat7=dt7(139:184,:);
daat8=dt8(139:184,:);
daat9=dt9(139:184,:);
daat10=dt10(139:184,:);
daat11=dt11(139:184,:);
daat12=dt12(139:184,:);
daat13=dt13(139:184,:);
daat14=dt14(139:184,:);
daat15=dt15(139:184,:);
testdata=[daat1;daat2;daat3;daat4;daat5;daat6;daat7;daat8;daat9;daat10;daat11;daat12;daat13;daat14;daat15];
test_data=testdata';
label1= [ones(1,138),2*ones(1,138),3*ones(1,138),4*ones(1,138),5*ones(1,138)];
label2= [6*ones(1,138),7*ones(1,138),8*ones(1,138), 9*ones(1,138), 10*ones(1,138)];
label3= [11*ones(1,138),12*ones(1,138),13*ones(1,138), 14*ones(1,138), 15*ones(1,138)];
label4= [ones(1,46),2*ones(1,46),3*ones(1,46),4*ones(1,46),5*ones(1,46)];
label5= [6*ones(1,46),7*ones(1,46),8*ones(1,46), 9*ones(1,46), 10*ones(1,46)];
label6= [11*ones(1,46),12*ones(1,46),13*ones(1,46), 14*ones(1,46), 15*ones(1,46)];
train_label=[label1,label2,label3];
test_label=[label4,label5,label6];
trainlabel=train_label';
testlabel=test_label';
mdl1 = ClassificationKNN.fit(traindata,trainlabel,'NumNeighbors',3);
predict_labelk1= predict(mdl1, testdata);
% svmModel = svmtrain(traindata, trainlabel);
% predict_labels1 = svmclassify(svmModel,testdata,'showplot',true);
nb1 = NaiveBayes.fit(traindata, trainlabel);
predict_labeln1=predict(nb1, testdata);
B = TreeBagger(20,traindata,trainlabel);
predict_labelb= predict(B,testdata);
for bi=1:690
labelb=cell2mat(predict_labelb(bi,1));
labelb1=str2double(labelb);
predict_labelb1(bi,1)=labelb1;
end
predict_labelkk=[predict_labelkk;predict_labelk1];
predict_labelnn=[predict_labelnn;predict_labeln1];
predict_labelbb=[predict_labelbb;predict_labelb1];
testlabels=[testlabels;testlabel];
end
% accsvm=sum(predictss_labels==tess_label)/size(tess_label,1);
accknn=sum(predict_labelkk==testlabels)/size(testlabels,1);
accnb=sum(predict_labelnn==testlabels)/size(testlabels,1);
accforest=sum(predict_labelbb==testlabels)/size(testlabels,1);
为什么老师出现
未定义函数或变量 'video_caadis_15'。
出错 voting_1113zijixiugai (line 5)
data1=video_caadis_15(1:184,:);
最后
以上就是复杂自行车为你收集整理的matlab出错leveling,老是出现错误未定义变量的全部内容,希望文章能够帮你解决matlab出错leveling,老是出现错误未定义变量所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复