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?

 Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 15 Apr. 2024

0 Stimmen

Instead of sldiagviewer.reportError(errMsg), if you do error(errMsg), it should stop.

3 Kommentare

RIchard
RIchard am 15 Apr. 2024
I was hoping to avoid that as it sends it to the command window
Fangjun Jiang
Fangjun Jiang am 15 Apr. 2024
Bearbeitet: Fangjun Jiang am 15 Apr. 2024
okay, try modelName([],[],[],'term'). I think model update is equivalant as modelName([],[],[],'compile')
RIchard
RIchard am 16 Apr. 2024
Bearbeitet: RIchard am 16 Apr. 2024
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu General Applications finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Gefragt:

am 15 Apr. 2024

Bearbeitet:

am 16 Apr. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by