MATLAB: How to create a mask for the subsystem where each parameter depends on the other parameters in the mask

simulink

I have three parameters in my mask 'a','b','c'. When any of the parameter is changed manually the other parameters must change automatically according to my algorithm. I have placed my algorithm as a callback for all three parameters so that it will be called whenever any of the parameters change. However, this gives rise to recursive behavior of the mask which leads to erroneous results.

Best Answer

Execution of a mask parameter callback when the mask dialog box opens is intended behavior. The callbacks execute when the dialog first opens, allowing Simulink to initialize the dialog properly. Note that mask parameter callbacks are typically used to manipulate the enabled and visible states of mask parameters in dynamic dialogs
In cases where the mask callbacks lead to recursive behavior it is best to change the design of the mask. The original design can lead to recursive calls which can be very error prone. A better design would be to have the user choose which variable they would like to update and calculate the other variables inside the mask. An example is attached.