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

Answers (1)

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.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Asked:

on 5 Nov 2015

Answered:

on 5 Nov 2015

Community Treasure Hunt

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

Start Hunting!