Doug Hull, MathWorks
(Originally posted on Doug's MATLAB Video Tutorials blog.)
In some code there is an enumerated set of choices. People will use a switch case statement to check for all but one choice and then catch that last one in the 'otherwise' block of their code. However, if there is unexpected inputs, the 'otherwise' will fire when it should not.
This video shows a technique for catching this problem. It is important to catch these errors from unexpected inputs immediately, because they can have effects on your code much farther down the line. When this happens, it would be hard to trace back to the cause.
Recorded: 25 Mar 2013