I want to open figure only when user dialog of mask is open
3 次查看(过去 30 天)
显示 更早的评论
I have a mask with a user dialog. I have a few issues with a figure at this dialog:
1) If the dialogue is open then the function "opening_diagram_callback" should be open and if the user changes anything, this figure should be updatet.
2) If the user closes the user dialog the figure should be also closed automatically.
3) If the simulation is started the figure shouldn't appear.
At first I tried it to put the "opening_diagram_callback" function in the init function. But then the second point isn't possible and it also appears during simulation because there it also runs through the init function.
Can someone please help me with this problem??
回答(1 个)
Jaimin
2024-12-4
Hi @Bernhard
To address your issues with the dialog and figure management in Simulink, consider the following two resources that might help you find a solution:
- Initialize Mask – Simulink (https://www.mathworks.com/help/simulink/ug/initialize-mask.html): This documentation provides detailed information on how to initialize masks in Simulink. It explains how to use initialization commands to manage callbacks like “opening_diagram_callback”, ensuring that figures are correctly updated and managed based on user interactions.
- Author Mask Init Callback – Simulink (https://www.mathworks.com/help/simulink/ug/author-mask-init-callback.html): This guide offers insights into authoring mask initialization callbacks in Simulink. It includes instructions on implementing callbacks that can help manage the opening and closing of figures in response to dialog events, without interfering with simulations.
To prevent the image from displaying during simulation, utilize the “SimulationStatus” property of “bdroot”.
Kindly refer following code snippet for understanding.
isSimulating = strcmp(get_param(bdroot, 'SimulationStatus'), 'running');
I hope this will be helpful.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!