how to turn off a warning dialog box

6 次查看(过去 30 天)
i would like to hide a message dialog, which pops up when I click on a subsystem mask to modify a parameter.
this is the message:
*| Warning
attempt to change parameters of a blocks within a library link.
These changes can later be discarded or propagated to the library
and two buttons OK CANCEL|*
I tried with
[a, MSGID] = lastwarn();
warning('off', MSGID)
warning off
but it is still there jumping around all the time.
do you have any idea of how I can hide this dialog box?

采纳的回答

Image Analyst
Image Analyst 2012-3-9
See this snippet of code for an example. It has some instructions in there for you to adapt it to any error.
% Turn off note "Warning: Added specified worksheet." that appears in the command window.
% To set the warning state, you must first know the message identifier for the one warning you want to enable.
% Query the last warning to acquire the identifier. For example:
% warnStruct = warning('query', 'last');
% msgid_integerCat = warnStruct.identifier
% Command window will show this:
% msgid_integerCat =
% MATLAB:xlswrite:AddSheet
% You need to pass the expression with the colons in it into the warning() function.
% Turn off note "Warning: Added specified worksheet." that appears in the command window.
warning('off', 'MATLAB:xlswrite:AddSheet');
  2 个评论
grapevine
grapevine 2012-3-9
Thank you for the help, I tried these instructions:
msgid_integerCat = warnStruct.identifier
warnStruct = warning('query', 'last')
but I cannot get the identifier of the message box
While it appears I can only fish out that one
identifier: 'Simulink:SL_UsingDiscreteSolver'
state: 'off'
Image Analyst
Image Analyst 2012-3-9
Well first of all, you'd have to reverse the order of those two lines:
warnStruct = warning('query', 'last')
msgid_integerCat = warnStruct.identifier
To turn that off warning, you'd do:
warning('off', 'Simulink:SL_UsingDiscreteSolver');
but from your comment, it looks like that one is already off so I think you got the wrong warning code.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by