Usually Matlab creates very helpful error messages, e.g.:
??? Subscript indices must either be real positive integers or logicals.
It does not require much experience to identify the source of this error rapidly. (Finding a solution is completely different story!) Compared with e.g. the messages of famous operating systems or the GCC compiler, the high quality of these messages is extremely helpful.
Do you know counter-examples? Some misleading or irrelevant messages created by Matlab?
No products are associated with this question.
My all-time favourite is
Caught unexpected exception of unknown type.
In Matlab5.3 (R11), but not in modern releases:
% First time: reshape(1, [-1 -1]) ??? Error using ==> reshape Don't do this again!.
% Second time: reshape(1, [-1 -2]) ??? Error using ==> reshape Cleve says you should be doing something more useful.
% Third time: reshape(1, [-1 -3]) ??? Error using ==> reshape Seriously, size argument cannot be negative.
Definitely on the irrelevant side, but luckily it was taken care of pretty quickly. I think it might be the first bug I reported to TMW.
Basically someone at TMW left a debugging message in the serial port object callback so that it would always rethrow the last warning.
The guilty one:
foo('') Undefined function 'foo' for input arguments of type 'char'.
foo Undefined function or variable 'foo'.
Use as variable OR function?
clear foo sum(foo) Undefined function or variable 'foo'.
The two error messages considered together make you think that the first one is simply not properly behaving BECAUSE of the input.
However, most commonly it's the case of "undefined function" which is already implemented!
I suggest to suppress the first one and throw always the second message.
Another unhelpful aspect of error handling in MATLAB is if you catch an error in a callback and then rethrow the error, you lose the stack information.
Invoke Error, Dispatch Exception: Exception Error Occurred
isn't the most enlightening of messages...