MESSAGE function and error handling

26 views (last 30 days)
Daniel Shub
Daniel Shub on 19 Jun 2012
Answered: Walter Roberson on 16 Feb 2018
I just stumbled across the MESSAGE function which takes a message identifier of the form
and creates an object that can be used with ERROR and WARNING that has the same id and the corresponding error/warning message. This seems like it could provide an easy way of making the error handling in my code more consistent with TMW error handling. To do this I would need a list of the standard message ids.
Is there a documented list of all the error message ids someplace?

Answers (2)

Aditya Hegde
Aditya Hegde on 16 Feb 2018
Use the lasterror command to see the error id. For example if you are using strrep and it throws an error, you can then use the lasterror command to check the error id. Hope this helps.


Community Treasure Hunt

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

Start Hunting!