Info
此问题已关闭。 请重新打开它进行编辑或回答。
dimension mismatch error in for loop
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!