Array indices must be positive integers or logical values.
이전 댓글 표시
sigma = 1.0;
Red=double(Red);
NIR=double(NIR);
knr = exp(-(NIR-Red) ^2/(2*sigma ^2));
kNdvi = (1-knr)/(1+knr);
figure,imshow(kNdvi,[]);
colormap(summer);
colorbar;
Error in kNDVI (line 10)
knr = exp(-(NIR-Red) ^2/(2*sigma ^2));
채택된 답변
추가 답변 (2개)
the cyclist
2021년 8월 9일
편집: the cyclist
2021년 8월 9일
0 개 추천
Is it possible that you defined a variable called exp? If so, then MATLAB is trying to index into that variable, rather than calling the function. (Never name a variable the same as a MATLAB function.)
If that does not solve your problem, it would be helpful if you uploaded a MAT file and full code required to replicate the error. Otherwise, there is too much guesswork for us.
댓글 수: 3
Simba
2021년 8월 9일
the cyclist
2021년 8월 10일
I won't be able to run your code locally, because I do not have the Image Processing Toolbox. But right now no one can run your code, because we don't have those input files. (It's difficult to tell if the inputs are important.)
Simba
2021년 8월 11일
Image Analyst
2021년 8월 10일
0 개 추천
See the FAQ for a thorough discussion and explanation of the error:
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!