Stop Simulink Model Update via Callback

6 次查看(过去 30 天)
I have a callback on a custom block that checks a bus selector for missing signals, at the start of the model update routine. Based on the results of that update, I send an sldiagviewer.reportError(errMsg) command to Matlab. What I want it to do is stop the update cycle at that point because I know it will throw an error downstream in ~5 minutes where the user will have to fix the problem. Instead, Simulink just continues runnign the update cycle until Simulink decides it cannot continue anymore.
So my question is basically how to stop the update cycle?

采纳的回答

Fangjun Jiang
Fangjun Jiang 2024-4-15
Instead of sldiagviewer.reportError(errMsg), if you do error(errMsg), it should stop.
  3 个评论
Fangjun Jiang
Fangjun Jiang 2024-4-15
编辑:Fangjun Jiang 2024-4-15
okay, try modelName([],[],[],'term'). I think model update is equivalant as modelName([],[],[],'compile')
RIchard
RIchard 2024-4-16
编辑:RIchard 2024-4-16
Your orignal comment is correct and I have accepted it. Somehow, I was incorrectly calling `error`, and it was going to the matlab version instead of simulink.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by