필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

dimension mismatch error in for loop

조회 수: 1 (최근 30일)
xplore29
xplore29 2013년 5월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
Following is the overview of my problem
for i=1:iterations
compute XYZ
end
Each computation of XYZ is independent and has nothing to do with number of iterations. To be precise I am computing some error per iteration. The problem is that when I change the number of iterations, I get a dimension mismatch error at some random value of i. I dont understand what is wrong here because the loop is doing the same stuff for iterations = [10 100 1000] so if it can work for 100 iterations then why not for 1000 or more. My code has a lot of nested loops and I was wondering if variables get messed up . In that case should I clear them at the end of each function.
  댓글 수: 1
Jan
Jan 2013년 5월 5일
Without seeing the failing code, it is impossible to guess, what's going wrong.

답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 5월 5일
hi xplore29
maybe you are using a complex number "i" during the XYZ compuatation, if so, change it to "j" or sqrt(-1) and try again .
  댓글 수: 1
xplore29
xplore29 2013년 5월 6일
I am using an exp(.) in my computations. No complex number is involved.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by