Delete a block in Simulink changes the mux inputs and raises an error

2 views (last 30 days)
When I comment out some blocks from the Simulink file, it raised the following error,
----------------------------------------------------------------
Error in port widths or dimensions. 'Output Port 1' of 'closeloop_thetaPhi_both_2021_12_03/Saturation' is a one dimensional vector with 1 elements.
Component: Simulink | Category: Model error
Error in port widths or dimensions. 'Input Port 2' of 'closeloop_thetaPhi_both_2021_12_03/Mux' is a one dimensional vector with 2 elements.
-----------------------------------
What I did was remove the fcn blocks and connect the lines.
Original_diagram
This is the rearranged version (the one creates errors). As in the diagram, saturation block outputs the 1 dimention values but Mux sees it as a 2 dimension vector
error block
can anyone help me to solve this issue.

Answers (1)

sanidhyak
sanidhyak on 25 Jun 2025
I understand that you are encountering a "port widths or dimensions" error in Simulink after commenting out certain blocks and rewiring the diagram, involving a "Saturation" block and a "Mux" block. The error message indicates that the "Saturation" block outputs a 1-dimensional scalar, but "Mux" input port "2" expects a "1×2" vector, which hence leads to a signal dimension mismatch.
In your modified diagram, since the original function ("Fcn") blocks were removed, Simulink no longer receives two separate scalar inputs but instead gets a single "1×2" vector, which causes the conflict. To resolve this issue, you can refer to one of the two methods below:
Method 1: Correct the "Mux" Block Configuration
  1. Double-click on the "Mux" block.
  2. Make sure that the number of inputs is set correctly (for e.g., "2" for combining two scalars).
  3. Verify that you are feeding two individual scalar signals to the "Mux" instead of a pre-concatenated vector.
This now ensures that the "Mux" block receives the expected signal structure and avoids dimension mismatches.
Method 2: Use a "Vector Concatenate" Block
  1. Navigate to: "Simulink > Signal Routing > Vector Concatenate".
  2. Replace the "Mux" block with this block.
  3. Now, connect your "Saturation" output and the other input signals accordingly.
For further reference, kindly refer to the following official documentations:
I hope this helps!

Categories

Find more on Modeling in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!