how can i prevent bogus values while executing a loop consist of variables?

sir, In my program there is a loop having both starting and ending values are variable which is called earlier in the program.when executing i got bogus value as result.but when i give the values of the variables directly just before the loop i got correct result.why this happens?how can i solve this? concerned loop in my program is attached here..n my problem is the result obtained as "sumB"..in that the variables "g" and "h" was obtained earlier

Respuestas (1)

Thorsten
Thorsten el 5 de Nov. de 2015
Have you checked the value of sumB before the loop? Maybe you assume sumB to be 0 but it is not from a previous run of the loop.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Nov. de 2015

Respondida:

el 5 de Nov. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by