Effacer les filtres
Effacer les filtres

Simulink mask: show/hide the port of a custom Simulink block

16 vues (au cours des 30 derniers jours)
federico ciresola
federico ciresola le 2 Août 2024 à 7:49
Modifié(e) : federico ciresola le 2 Août 2024 à 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):
I am struggling how to implement this feature in the Checkbox callback because I can't find the parameter to show/hide the port.

Réponses (1)

SACHIN KHANDELWAL
SACHIN KHANDELWAL le 2 Août 2024 à 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:
  1. Open Simulink and add a Subsystem block.
  2. Select Mask > Create Mask.
  3. Add a Checkbox and other properties that you want.
  4. Add the callback for the Checkbox.
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 commentaire
federico ciresola
federico ciresola le 2 Août 2024 à 10:08
Modifié(e) : federico ciresola le 2 Août 2024 à 10:08
thank you for you answer, I alread have did them. My problem is find a way to show or hide some inputs port from a checkbox such as the integrator block.

Connectez-vous pour commenter.

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by