MATLAB: Is it possible to allow the If block in SIMULINK to accept inputs with different data types

clauseconditionelseelseifsimulinkuniform

I am using an IF block and If-Action subsystems in my SIMULINK model that represents the following pseudocode:
if (u1 > 0) {
body_1;
}
else if (u2 > 0){
body_2;
}
else {
body_3;
}
The variables 'u1' and 'u2' that I want to use are of data types 'double' and 'single' respectively. When I execute this model, I receive the following error:
Data type mismatch. Input port 2 expects a signal of data type 'double'. However, it is driven by a signal of data type 'single'.
This implies that the data types of the inputs to the IF block are determined based on the data type of he first input to the IF block.
I would like the inputs to have different data types.

Best Answer

The If block expects all inputs to be of the same data type.
To work around this issue, use the 'Data Type Conversion' block from the 'Ports and Subsystems' library to change the data type of the appropriate signal.