MATLAB Answers

MESSAGE function and error handling

24 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
foo:bar:id
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?

  0 Comments

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 16 Feb 2018
There is no documented list. To see what exists, see my discussion at https://www.mathworks.com/matlabcentral/answers/373512-how-can-i-open-message-key-catalog#answer_296850

  0 Comments

Sign in to comment.


Aditya Hegde
Aditya Hegde on 16 Feb 2018
Hi,
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.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags