There's an error, or an out-of-date usage, in the book. The correct Matlab function is upper, not toupper.