Variable Size Array bounds when compiling Simulink Model not working
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jan-Felix Klein
el 2 de Jul. de 2018
Comentada: Jan-Felix Klein
el 12 de Jul. de 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 comentarios
Respuesta aceptada
Alok Nimrani
el 10 de Jul. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Model Verification en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!