MATLAB: Am I receiving the following error message in the Simulink model: Invalid setting for output port dimensions

dimensionserroroutportportsimulink

Why am I receiving the following error message when I update or run my Simulink model?
Invalid setting for output port dimensions of block 'Path_to_Mux_Block'. The dimensions are being set to 1. This is not valid because the output has fewer elements than the total number of input ports of this block

Best Answer

This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
The model is under specified in terms of the "expected" dimensions. There are inputs that have dynamic widths and no blocks that actually explicitly specify widths in the model. Simulink, therefore, is attempting to solve to the best consistent dimensions and is not able to determine a unique solution for all the dimensions in the model.
The error that you are seeing is related to the fact that the best solution that Simulink could find was to have a scalar value for the output of the Mux which is not compatible with the rest of the model.
The fix is to explicitly specify the expected width of, for example, the input ports on the root level of the model. Alternatively, if you know what the dimensions of a certain line should be, you should add a "Signal Specification" block and explicitly specify the dimensions of that line.
Another solution would be to add dimensions information to the Mux block dialog. For instance, if the Mux has 3 input ports and they expect the port dimensions to be 1, 3, and 5, you can type '[1 3 5]' in the Mux block dialog.