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

3 Ansichten (letzte 30 Tage)
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).

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 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.
 

Weitere Antworten (0)

Kategorien

Mehr zu Software Development Tools finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by