Output 'y' has variable size but the upper bound is not specified; explicit upper bound must be provided.

99 views (last 30 days)
y = 10
coder.varsize('y', [1,20000]);
These lines of code are inside a for loop and I expect the size of the variable y to increase. This is MATLAB function. I get the following error "Output 'y' has variable size but the upper bound is not specified; explicit upper bound must be provided." I have taken a look at other examples but couldn't find a solution to it.
I even checked the box for variable size in ports and data manager of the function.
Please let me know how can I fix this error. Help is appreciated.
  3 Comments
Tim Gerbert
Tim Gerbert on 6 Nov 2020
Hi,
I have similar problem and checked point 4 in Simulation Target --> Advanced parameters category:
"Make sure that the model is configured for dynamic memory allocation:
  • The Dynamic memory allocation in MATLAB functions check box is selected.
  • The Dynamic memory allocation threshold in MATLAB functions parameter has the default value 65536."
I have attached an example. Can you provide help?
Thanks and Kind Regards
Tim

Sign in to comment.

Answers (0)

Categories

Find more on Multidimensional Arrays 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!