Postprocessing when user clicks apply/ok in a mask

I need to do some postprocessing (altering a block depending on the user selection in the mask) whenever a user clicks the APPLY or OK button on a simulink mask. I do not want to do this on the fly as many settings have to be made and the processing take a while, so doing this on each change over again gets very annoying.
How can I achieve this?
Same for preprocessing when a mask is opened. However this is not cruicial, as I) have found a workaround byusing the callback of a hidden combobox as a workaround. However it would be nice to clean that up too...

댓글 수: 3

Can you try using the Mask Initialization function callback to do that?
Regarding when a mask is opened, did you try to use the OpenFcn block callback?
Thank you for your feedback.
Marcus
Marcus 2026년 1월 9일
편집: Marcus 2026년 1월 9일
The mask initialization callback is only loaded once, seems when the model is loaded first into memory, not on every opening of the mask. Also not on apply or close.
Oliver Jaehrig
Oliver Jaehrig 2026년 1월 14일
편집: Oliver Jaehrig 2026년 1월 14일
@Marcus Mask Initialization code is not only called one when the model is loaded. Please see this documentation when you use R2025b to see when it gets executed:
Here you can find the R2024b documentation:
The expectation is that when you change the Mask Workspace the callback should execute. This can be also used to trigger the callbacks by using a hidden variable if needed which changes to trigger the callback.
If you prefer I recommend you to create a Technical Support case, where we can support you further.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Model, Block, and Port Callbacks에 대해 자세히 알아보기

제품

릴리스

R2024b

질문:

2026년 1월 8일

편집:

2026년 1월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by