A question came up on the MATLAB newsgroup about debugging a sorting algorithm. I thought this was an excellent opportunity to show how visualization of intermediate results would help to determine why an algorithm does not work as hoped.
This technique of adding intermediate plots as a means of debugging is important to MATLAB programming. Because such visualization is easy, you should use it to make sure you understand your algorithm.
The original thread with the question is here