Get the msgid of a certain warning?

8 visualizzazioni (ultimi 30 giorni)
Guanyu Wang
Guanyu Wang il 25 Set 2017
Commentato: Guanyu Wang il 27 Set 2017
When I generate c-code from my Simulink model, 19000+ warnings were generated as ~20 categories. One of category is ' An ERT or ERT derived target is required to preserve the names of alias data types in the generated code. Reverting to builtin types during code generation.' . I want to ignore this type of warning by using the [warning('off', msgid)] command. However, because these warnings lie in the middle of all warnings, I cannot get their msgid by using ' _ lastwarn_' function. Is there anyway to get msgid just based on the warning texts?
Thanks a lot!

Risposta accettata

Robert U
Robert U il 27 Set 2017
Hi Guanyu Wang:
use the function warning with enabled verbosity to display extended warning messages (including suppression command):
warning('on','verbose')
The command has to be written before executing your code containing warnings. Shutting it off again is done straight forward by
warning('off','verbose')
Answer found here:
Kind regards,
Robert
  2 Commenti
Guanyu Wang
Guanyu Wang il 27 Set 2017
Robert,
Thanks for your help! I tried turning on VERBOSE warning mode. The result is, for warnings shown in the Matlab command window, by turning on the VERBOSE mode I can find the msgid I am interested in. However, for the Simulink warnings, they are still only available from the "Diagnostics Viewer", which msgIDs are not shown. ---------------------------------------------------------------- Update:
I did a research trying to find a method to show diagnostics messages at the command window, and here is it: rtwbuild('ModelName').
So combining Robert's and my methods, the way to show msgid of warnings is: 1. type warning('on','verbose') %% or warning on verbose is also accepted syntax. 2. type rtwbuild('ModelName') and you can see all warnings with their msgid listed in the cmd window. Then just search for your interested ones using Ctrl+f. Wish this solves headaches for people having similar problems. Thanks again Robert!
Guanyu Wang
Guanyu Wang il 27 Set 2017
A reminder: when using rtwbuild('ModelName') command, do not forget the quotation marks. Or you could get an error saying # of input arguments is incorrect. Good luck guys!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su General Applications in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by