79787652

Date: 2025-10-10 19:54:02
Score: 0.5
Natty:
Report link

First, are A, B, and C subsystems?

If not, Simulink requires that every output variable in a MATLAB Function block have a fixed dimension.
If the variable V in Block C is not completely assigned or assigned values of different sizes in different conditions, Simulink cannot determine its dimension at compile time.
Hence the error

For instance:

function V = fcn(U)
if U > 0
    V = [1; 2; 3];  
else
    V = 0;         
end

In the code above, the output size of V changes depending on the condition.

To solve:
Clearly declare the size of V So it remains constant:

function V = fcn(U)
V = zeros(3,1);     % fix size at 3x1
if U > 0
    V = [1; 2; 3];
else
    V = [0; 0; 0];
end

Another way is that you can enable visual- signal in MATLAB settings

Open the MATLAB Function Block → Edit Data → check Variable size, set upper bound

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Abdulrasheed Kamal