How do I display a MATLAB error from a Simulink Model?
3 次查看(过去 30 天)
显示 更早的评论
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!"
0 个评论
回答(3 个)
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')
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.
0 个评论
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!'));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Verification 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!