Index in position 1 exceeds array bounds (must not exceed 4079). how to rectify this error

조회 수: 1 (최근 30일)
Index in position 1 exceeds array bounds (must not exceed 4079).
Error in outex_14>cal_AP (line 200) tests = CLBP_SMCH(testIDs,:);
Error in outex_14 (line 42) AP = cal_AP(Hist,trainIDs, trainClassIDs,testIDs, testClassIDs) This is the error i am getting when i am running the code. Ihave attached my code with this? how to make changes to match the size?
  댓글 수: 1
Adam
Adam 2018년 10월 5일
Learning to debug your code makes error such as this easy to find, and once you find them and see what is wrong you have far more knowledge of what the code is supposed to be doing than we do.
Clearly you are passing an index bigger than 4079 to an array of only 4079 elements. Debug and find out where this is, follow it back to find out why and then you can fix it.

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

채택된 답변

Dennis
Dennis 2018년 10월 5일
You are passing Hist and testIDs to your cal_AP function. In that function your try to access Hist(tesIDs).
Hist has 4079 rows (set by picnum early in your code), testIDs does not have this limitation and rather grows as long as there are images in your file. If there are more than 4079 you will get that error.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by