Hello João Araújo,
As per my understanding, you want to create a mask for a block with a parameter that can have ‘Input Port’ or ‘Dialog’ as its value and based on this value, you want to execute a code snippet.
You can use the Simulink Mask Editor to create the required mask for your block. Please follow the below mentioned steps to achieve the goal:
- Right-click on the block and select "Create Mask" in the ‘Mask’ section to open the Mask Editor.
- In this Mask Editor, open the "Parameters & Dialog". Drag a “popup” type field from the left side ‘parameter’ gallery and drop into the "Parameters & Dialog" tab. Set the “prompt” field to a meaningful name like “Frequency Switch”.
- You can then specify a list of options in the "Type Options" property in separate lines, for example 'Input Port’ ; ‘Dialog'.
- In the "Callback" field, you can enter the code that should be executed when the parameter value changes. Here, you can implement your logic to replace the block based on the selected option.
- You can then save the mask and close the editor.
Now, when you double-click on the block, you should see the mask dialog with the desired selectable options for the “Frequency Switch” parameter. On selecting an option, corresponding code will get executed in the callback function.
Refer to the following documentation to understand more about creating callback functions in a mask:
Hope this helps you proceed further!