Why is my code that includes MATLAB message identifiers not working in MATLAB 7.13 (R2011b) and later?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 6 Mar 2012
Edited: MathWorks Support Team
on 5 Jan 2016
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
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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!