필터 지우기
필터 지우기

Suppress Warning Messages

조회 수: 15 (최근 30일)
Mike
Mike 2012년 1월 3일
댓글: Alexei M 2017년 4월 7일
Is there a way to suppress the "Warning: Visualization blocks are not updated during command line simulation in rapid accelerator mode." messages?
The visualisation blocks are useful when running my model from Simulink so I don not want to delete them but I don't wand to receive the errors when running from the command line.
Thanks
Mike

채택된 답변

Honglei Chen
Honglei Chen 2012년 1월 3일
You can use
warning('off','message_id')
to turn off a specific warning. You can use lastwarn to find out the message_id corresponds to the visualization block warning. Details can be found in the doc
doc warning
HTH
  댓글 수: 1
Mike
Mike 2012년 1월 3일
Thanks for your help.
One additional point for others who may want to use this solutions is that I had to use '[msgstr, msgid] = lastwarn' to get the message_id as lastwarn only repeats the error message.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 1월 3일
Here's a well-commented snippet of my code that you may find helpful. I used it to suppress an Excel informational message.
% 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.
% To get that, 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');
  댓글 수: 3
Image Analyst
Image Analyst 2017년 4월 7일
It's just for that session. If you want to suppress them permanently, you can call my attached TurnOffWarnings() function from your startup.m file. Modify it for additional warnings that you encounter that you'd with to suppress.
Alexei M
Alexei M 2017년 4월 7일
Thanks!

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by