How do I display a MATLAB error from a Simulink Model?

조회 수: 7 (최근 30일)
Nuno
Nuno 2011년 7월 13일
댓글: Wen Yin Tay 2020년 12월 19일
Hi... I construct a model in simulink... How i make to appear in Matlab window one message with error?
For exemple, when V<0.1 appear in Matlab window: "Voltage error!"

답변 (3개)

Friedrich
Friedrich 2011년 7월 13일
Hi,
it exists a block called MATLAB Function. Simply take this block and take the voltage as input signal. In this Block you can use normal MATLAB syntax and you could write
%warning is displayed
warning('warn text')
%or error is displayed
error('error text')
  댓글 수: 1
Wen Yin Tay
Wen Yin Tay 2020년 12월 19일
Can I show error message without stopping the simulation?

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


Doug Eastman
Doug Eastman 2011년 7월 13일
You could also use the the blocks in the Model Verification library, such as Check Static Lower Bound. Set the lower bound to 0.1 and set the callback to something like:
disp('Voltage error!')
You can uncheck the Stop simulation option if you want the simulation to continue even after this condition has been detected.

Image Analyst
Image Analyst 2011년 7월 13일
I don't know Simulink, but I think it can run MATLAB commands such as
uiwait(warndlg('Voltage Error: Voltage < 0.1!'));

카테고리

Help CenterFile Exchange에서 Model Verification에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by