How can I return an error message when a dialog parameter of a masked subsystem is invalid in Simulink?

조회 수: 2 (최근 30일)
I have a masked subsystem with one dialog parameter. When the value entered for this dialog parameter is invalid, I would like to be able to return an error message when the model is updated and stop execution.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
It is possible to display an error message and abort execution in Simulink using the ERROR function.
One can check for the validity of the dialog input in the mask initialization commands section and invoke the ERROR function with a desired error message if the input is found to be invalid. For example, if the dialog parameter is stored in the variable errID and is invalid if it is greater than 100, then the initialization section can have the following code:
if(errID >100)
error('The error ID is too large');
end

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by