- Open Simulink and add a Subsystem block.
- Select Mask > Create Mask.
- Add a Checkbox and other properties that you want.
- Add the callback for the Checkbox.
Simulink mask: show/hide the port of a custom Simulink block
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
federico ciresola
el 2 de Ag. de 2024 a las 7:49
Editada: federico ciresola
el 2 de Ag. de 2024 a las 10:08
Hi guys,
I am creating a mask for my custom block and I want add a checkbox with the following behaviour:
- checked: it shows a new port the the block
- unhecked: it hides the new port for the block
The integrator block has the same behaviour (see the belows images to understand):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1745391/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1745396/image.png)
I am struggling how to implement this feature in the Checkbox callback because I can't find the parameter to show/hide the port.
0 comentarios
Respuestas (1)
SACHIN KHANDELWAL
el 2 de Ag. de 2024 a las 8:57
I understand that you want to create a block mask with the help of a checkbox. Here are some possible steps that might be helpful to you:
After creating the callbacks, you can simply get the current callbacks using the following command:
>> maskObj = Simulink.Mask.get(gcb);
After you have the mask object, you can modify it based on your needs.
The following documentation could be helpful for you to design the mask:
Hope the above information is helpful!
1 comentario
federico ciresola
el 2 de Ag. de 2024 a las 10:08
Editada: federico ciresola
el 2 de Ag. de 2024 a las 10:08
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!