Error using Simulink.c​reateFromT​emplate: Arrays have incompatible sizes for this operation

13 views (last 30 days)
Hi everyone,
I'm trying to learn the Onramp Simulink coursel, but I keep getting the following error message:
Error using Simulink.createFromTemplate (line 73)
Arrays have incompatible sizes for this operation.
Error in learning.simulink.StudioMgr/createNewModel
Error in learning.simulink.StudioMgr
Error in learning.simulink.Application/setupStudioManager
Error in learning.simulink.Application/setupSimulinkStudio
Error in LearningApplication.setupSimulinkStudio
I’m using MATLAB R2025b with Simulink Onramp / Learning App installed. (Student Licensed)
The error appears whenever I try to start a new model through the Learning App.
My questions:
  1. What typically causes this “Arrays have incompatible sizes” error inside Simulink.createFromTemplate?
  2. Is it related to a corrupted template (.sltx) file or a version mismatch with the Learning App?
  3. How can I inspect or repair the templates used by the Learning/Onramp environment?

Answers (1)

Leepakshi
Leepakshi on 14 Nov 2025 at 4:56
Hi Tai,
This error occurs when you have a size mismath in your arrays. Not sure at which level in course you are facing this issue.
But here is documentation from Mathworks for handling this error, it might help you. https://www.mathworks.com/help/simulink/ug/resolve-error-size-mismatches.html
In case of simulink, sometimes setting the Simulink solver to "variable step size" leads to variable sizes of the output arrays as well. When simulink changes the step size, the objective function returns arrays with incompatible sizes for the gradient calculation. Just guessing, but this might be one of the reason for your error. Refer to below MATLAB Answer stating the same:
There are many answers on community for this error, try referring to them if specific issue is not answered here.
If it feels like this is an issue in course, try contacting Mathworks support using this link:
Hope this helps!

Products


Release

R2025b

Community Treasure Hunt

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

Start Hunting!