Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

dimension mismatch error in for loop

1 visualización (últimos 30 días)
xplore29
xplore29 el 5 de Mayo de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Jan
Jan el 5 de Mayo de 2013
Without seeing the failing code, it is impossible to guess, what's going wrong.

Respuestas (1)

Youssef  Khmou
Youssef Khmou el 5 de Mayo de 2013
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 comentario
xplore29
xplore29 el 6 de Mayo de 2013
I am using an exp(.) in my computations. No complex number is involved.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by