I am getting an error that "array indices must be positive integers or logical values" How to solve?
조회 수: 2 (최근 30일)
이전 댓글 표시
Array indices must be positive integers or logical values.
Error in get_im_label (line 14)
if ~strcmp(dataname(j).name(end-1:end),'db') % ËÎ
Error in curet (line 17)
imageDatasetLabel = get_im_label(imdir);
this is my error. How to solve this error?
댓글 수: 3
Dennis
2019년 3월 6일
The error states that one of your indices is not a positive integer. This could be j (impossible to tell without your code), but my guess is that there might be only one entry in name.
답변 (1개)
KSSV
2019년 3월 6일
Note that MATLAB accepts only non zero positive integers and logicals as indices. Else from these every thing throws error.
A = rand(10,1) ;
A(1) % no error
A(3) % no error
A(-1) % throws error
A(0) = % throews error
idx = A<0.5 ; % idx will be logical
A(idx) % no error
Check your code where and why the index is getting negative.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Chebyshev에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!