how to run the matlab code step-by-step?

98 views (last 30 days)
bsd
bsd on 26 Jul 2011
Dear sir/madam,
I need to run the matlab code step-by-step, and also see what is happening in the code or the variables. How can I do this? Looking forward to hearing from you soon.
Thanking you, BSD

Answers (3)

Arnaud Miege
Arnaud Miege on 26 Jul 2011
Use the debugger. See Editing and Debugging MATLAB Code in the documentation for more details.
HTH,
Arnaud
  1 Comment
Jan
Jan on 26 Jul 2011
@Arnaud: Thanks for this important answer. Although it might seem so obvious, there are a lot of questions in this forum, which could be avoided, if the user knows how to apply the debugger. +1

Sign in to comment.


Andreas Goser
Andreas Goser on 26 Jul 2011
Many users also prefer not line by line, but a bit larger chunks. Look for "Cell Mode".
  3 Comments
Arnaud Miege
Arnaud Miege on 27 Jul 2011
If you read the section of the documentation I mentioned in my answer, you'll see there is a part entitled "Evaluating Subsections of Files Using Code Cells".

Sign in to comment.


Daniel Shub
Daniel Shub on 27 Jul 2011
There is a recent blog post by Loren http://blogs.mathworks.com/loren/2011/04/28/is-there-an-echo-out-there/ about the echo command. Cell mode and the debugger are nice, but I think a lot of us have forgotten (or never knew) the power of echo.

Categories

Find more on Marine and Underwater Vehicles in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!