From: Sean Douglas on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i3htlh$bf2$1(a)fred.mathworks.com>...
> Dear Sean,
>
> what did the debugger tell you ?!
>
> If you use an offically released Matlab version and your computer is not damaged or magic, the FOR loop will *not* increase i by 2.
>
> while(m+p<=n)
> disp('*** I start the FOR loop now');
> for i =(m+p):n;
> fprintf('== i is %g\n', i)
> if((s(i)/Mc(i)-s2(i)/Mc2(i)>spread1)&&(flag==1))
> ...
> end
> end % FOR i
> end % while m+p <= n
>
> Please take the time to insert at least these two lines to display, when the FOR loop is started and when i is increased in the inner FOR loop. Matlab is for sure exactly doing, what you have commanded:
> for i = (m+p):n
> increases i by 1 in every *performed* iteration.
>
> Kind regards, have fun with the debugger, Jan

Dear, Jan
I'm working on the debugger , ive been wanting to figure out how to use the debugger, i guess now is a great time to do it,
From: Andy on
> Dear, Jan
> I'm working on the debugger , ive been wanting to figure out how to use the debugger, i guess now is a great time to do it,

To use the debugger, enter a break point right before the while loop (if you're editing your file with the built in editor, click on the little horizontal line to the left of the line, and it will turn into a red dot. This means you've set a break point there. Click it again when you want to get rid of it.)

Now run your code. When the execution of the program reaches the break point, it will stop, giving you control. The variables created by your function will appear in the workspace and you can see their values. You can press (I think, but check first) F10 to advance 1 line at a time. After each line, you'll have the opportunity to see the values of any variables you want.