Error: Index exceeds matrix dimensions.
이전 댓글 표시
Hi, Why do I get this message "Index exceeds matrix dimensions."??. At first I thought it was because that I named a variable with function name then I used "exist checkname " function to check and it gave me 0. So I'm still confused what might be the problem!
Code:
for k= 1: length(finalx); row3= ceil(finalx(k)*(10000+diffy3)); col3= ceil(finaly(k)*(10000+diffx3)); widthless= 3; widthmore=3; valuer3(k)= sum(B3((row3-widthless):(row3+widthmore),col3)); end figure(16) plot(finaly*(10000+diffx3),finalx*(10000+diffy3-widthless),'.g',... finaly*(10000+diffx3),finalx*(10000+diffy3+widthmore),'.r')
댓글 수: 3
Image Analyst
2014년 2월 20일
편집: Image Analyst
2014년 2월 20일
You need to tell us the entire error message. That means ALL THE RED TEXT. Don't snip or paraphrase. Then, whatever variables you see on that line, do a whos on:
whos finalx
whos diffy3
and so on. Then tell us what you find. One of the indexes will be more than the size of the array.
Oh, also, read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup so we'll be able to understand your code.
Lujain
2014년 2월 20일
Lujain
2014년 2월 20일
답변 (1개)
Dishant Arora
2014년 2월 20일
dbstop if error
try debugging your code using dbstop, it will tell when actually this error occurs.
댓글 수: 2
Dishant Arora
2014년 2월 20일
편집: Dishant Arora
2014년 2월 20일
type that in your command window and then run your code.
dbstop if error
YourScriptName % or run it directly from the editorwindow
Check out for your loop variables in the workspace after that
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!