Size mismatch Simulink after model restart
Show older comments
Hi all,
this question has been posted quite a few times but the solutions somehow don't work for me.
I have a simple simulink function of the form
fun [a,b] = myfun(c,d,e)
a = c-d;
b = d-e;
c,d, and e are vectors of the same constant size throughout the whole simulation.
previously, the Simulink model compiled without problems, but after a restart it gives the error: "Size mismatch (size [1x1] ~= size[5x1])" for a, and b. It doesn't make sense. I already tried to
- preallocate both variables with zeros(size(c))
- use bsxfun(@minus,c,d)
- restart the program, matlab, my computer
Yesterday evening, everything worked fine and I did change nothing in the code, only restartet my pc. The only thing that seems to be working is specifying the size of a and b in the model explorer. Since I start the simulation with different sizes of c,d, and e (all the same size though), it is not feasible for me to change it everytime.
It seems to be a common problem. Does anyone have a solution?
Thank you a lot in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!