Why is my code that includes MATLAB message identifiers not working in MATLAB 7.13 (R2011b) and later?

4 views (last 30 days)
Warnings
I have code that uses
warning('off',)
to turn off a warning message. My code used to work in earlier releases but does not work in MATLAB 7.13 (R2011b).
Errors
I have code that uses a try/catch statement and performs an action based on a specific error identifier. My code used to work in earlier releases but does not work in MATLAB 7.13 (R2011b).

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Jan 2016
From MATLAB 7.13 (R2011b) onwards, error and warning message identifiers have changed in MATLAB. If you use
warning('off',)
to turn off warnings, replace warning message identifiers that changed with the new message identifiers, to continue to suppress the warnings.
If you use a try/catch statement in your code, replace the old identifier with the new identifier.
See the table attached to this solution for a list of changed message IDs.
To determine the identifier for a warning, run the following command just after the warning message appears:
[MSG,MSGID] = lastwarn;
This command saves the message identifier to the variable MSGID.
To determine the identifier for an error, run the following command just after the error message appears:
exception = MException.last;
MSGID = exception.identifier;
Note on warnings: Warning messages indicate a potential issue with your code and should not be ignored. While you can turn off a warning, a suggested alternative is to change your code so it runs warning-free.
Refer to the attached document for MATLAB errors and warning identifiers that have changed till release R2013a.
 

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!