Variable Size Array bounds when compiling Simulink Model not working
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello guys,
I got the following problem: I am currently trying to compile a Simulink Model using Blocks from the Robotic System Toolbox to C++. The compiler struggles when using variable size arrays in embedded matlab blocks.
The function is very simple and looks like the following:
function TWaypoints = ellipse (numWaypoints)
coder.varsize('TWaypoints', [3 30]);
TWaypoints = zeros(3,numWaypoints);
end
Even I defined the bounds of the array, I still receive the error message:
Computed maximum size is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [3 x :?]. More information
Function 'ellipse calculation ' (#86.189.210), line 13, column 14: "zeros(3,numWaypoints)" Launch diagnostic report.
I dont't really know what I am missing and couldn't find anything helpful in similar questions about compiling Simulink models with variable-size arrays, so your help would be greatly appreciated :)
댓글 수: 0
채택된 답변
Alok Nimrani
2018년 7월 10일
Hello Jan-Felix Klein,
The error message is received because by default, a MATLAB Function block input signal or output signal is not variable-size. For a MATLAB Function block, you need to explicitly define the sizes and the upper bound in order to use the variable size signals. Go to the "Edit Data" option of the MATLAB Function from the Editor toolstrip and check the variable size box. Also, make sure you have specified upper bounds as described in the documentation:
Please note that this upper bound cannot be changed within the MATLAB function since dynamic memory allocation is not allowed for input and output signals as described in the following documentations:
I hope the above information is useful to you.
Thanks.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Model Verification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!