Why does not this function fully set the dimensions of output port while simulating?

3 views (last 30 days)
Hi everybody
I've been trying to simulated a planar five-bar parallel robot. The dynamic equations have been derived, modified and simplified by reduced model method.
The equations and inputs seems resonable, and I double checked the parameters and anything possible. but while simulating it, there is an annoying error below:
Error in default port dimensions function of S-function 'Dynamics_new_approach/MATLAB Function'. This function does not fully set the dimensions of output port 2
I'll apreciate it if anyone could help me with fixing this error.

Answers (1)

Saurabh
Saurabh on 9 Sep 2024
Hi Ramin,
It appears to be a MATLAB dimension mismatch, as the error indicates. I am providing a workaround here since I do not have access to the model:
  1. Open the MATLAB Function Block which reported the error and select Edit Data on the Editor tab. Alternatively select the block in the Model Explorer (CTRL+H).
  2. Select each variable corresponding to Input and Output ports, and in the Size edit box, specify the correct dimensions. The default is -1 or 'inherited', meaning automatically determined.
  3. Steps 1 and 2 may need to be repeated for other MATLAB Function Blocks in the model if they subsequently generate similar errors now.
See the following link for further information on the cause of this error:
I hope this was helpful

Community Treasure Hunt

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

Start Hunting!