필터 지우기
필터 지우기

Index in position 2 exceeds array bounds.

조회 수: 2 (최근 30일)
Zain Achmad
Zain Achmad 2021년 8월 31일
댓글: Walter Roberson 2021년 8월 31일
[ciri_latihZ,muZ,sigmaZ] = zscore(ciri_latih);
% pca
[coeff,score_latih,latent,tsquared,explained] = pca(ciri_latihZ);
% inisialisasi variabel kelas_latih
kelas_latih = cell(jumlah_file,1);
% mengisi nama2 sayur pada variabel kelas_latih
for k=1:300
kelas_latih{k} = 'Angry';
end
for k=301:600
kelas_latih{k} = 'Disgust';
end
for k=601:900
kelas_latih{k} = 'Fear';
end
for k=901:1200
kelas_latih{k} = 'Happy';
end
for k=1201:1500
kelas_latih{k} = 'Neutral';
end
for k=1501:1800
kelas_latih{k} = 'Sad';
end
for k=1801:2100
kelas_latih{k} = 'Surprise';
end
% ekstrak PC1 & PC2
PC1 = score_latih(:,1);
PC2 = score_latih(:,2);
PC3 = score_latih(:,3);
PC4 = score_latih(:,4);
PC5 = score_latih(:,5);
% klasifikasi menggunakan knn
Mdl = fitcecoc([PC1,PC2,PC3,PC4,PC5],kelas_latih);
i got some error on line 82 at "PC1 = score_latih(:,1);" it says Index in position 2 exceeds array bounds. and i don't know to solve it, and the program not get that error before
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 8월 31일
You could get that error if ciri_latih is empty.
For example it might be a global variable that you did not initialize.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by