Simulink- user define function - matlab funciton:Size of function not bounded error
조회 수: 4 (최근 30일)
이전 댓글 표시
I met a problem similar as (<http://www.mathworks.com/matlabcentral/newsreader/view_thread/310599),however>, things as little different.
Here is my problem: I create a matlab function in simulink and while i run this model, this block can't not works well: the error is as shown below:
Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?].
Next, i search online and find this page: http://www.mathworks.com/help/simulink/ug/defining-variable-size-data-for-code-generation.html
I follow the instruction and added the upper bound, however, it still not working. I take a look at the report, and find the variable is actually bounded: see pic below

actually, all the variable is bounded.

My code is as shown below:
step_w = (ub-lb)/1000;
coder.varsize('trq_all',[1 1001],[0,1]);
% trq_all = zeros(1,1001)
trq_all = [lb:step_w:ub];
ub is upper bound, lb is lower bound.
Thanks.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Event Functions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!