Variable Size Array bounds when compiling Simulink Model not working
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jan-Felix Klein
am 2 Jul. 2018
Kommentiert: Jan-Felix Klein
am 12 Jul. 2018
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 Kommentare
Akzeptierte Antwort
Alok Nimrani
am 10 Jul. 2018
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Model Verification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!