Index in position 1 exceeds array bounds.
古いコメントを表示
while trying to run this code an error occurs due to the first line (Happy ) and it says that
Index in position 1 exceeds array bounds.
Happy = [trainf(1,:);trainf(3,:);trainf(5,:);trainf(6,:);trainf(15,:);trainf(16,:)];
Surprise = [trainf(2,:);trainf(4,:);trainf(7,:);trainf(8,:);trainf(17,:);trainf(18,:)];
Sad = [trainf(9,:);trainf(10,:);trainf(11,:);trainf(12,:);trainf(19,:)];
Anger = [trainf(13,:);trainf(14,:);trainf(20,:)];
3 件のコメント
DGM
2021 年 11 月 25 日
How many rows are in trainf? Is it less than 16?
Maryam Almannaee
2021 年 11 月 25 日
回答 (1 件)
Navya Singam
2021 年 11 月 29 日
0 投票
Hi Maryam,
As the trainf is an empty matrix i.e trainf=[], and you are trying to refer to the rows of an empty matrix, the code is throwing an error. Try by initializing the trainf matrix with the data and the code may work.
カテゴリ
ヘルプ センター および File Exchange で Nearest Neighbors についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!