Using Simulink.Parameter in Matlab Function to make number of loops calibrateable

1 visualización (últimos 30 días)
Hello,
I have a Matlab Function in Simulink, which contains a for loop. The number of loops should be calibrateable and therefore is defined by a Simulink.Parameter.
for i = 1:MySimulinkParameter_C
% do stuff
end
% **** ERROR ****
But this seems to lead to an error. In the diagnostic viewer I only get the message " **** Error **** ".
When I change the upper value to a hard coded value I get no error
for i = 1:10
% do stuff
end
% no error
Does someone know the reason for this issue or can explain, how to furter debug this?
Thanks in advance!
  2 comentarios
Pascal Knappe
Pascal Knappe el 29 de Jul. de 2022
Hello Benjamin,
I attached an MWE. It is a little different than what I described initially because first it was difficult to reproduce the same error, but now it also appears in the MWE.
Additional information: In the MWE the error appeared only after changing the System Target File from default to "ert.tlc".

Iniciar sesión para comentar.

Respuesta aceptada

Pascal Knappe
Pascal Knappe el 22 de Ag. de 2022
So it seems newer versions than 19b have a report tool which gives one more details about errors in Matlab Functions. Trying to compile the MWE in 20b I get the error:
So I get that the problem is, that at compile time array sizes have to be fixed and can't be changed via calibration. At least with the STF ert.tlc, which is for C-Code compilation.
Thanks to myself!

Más respuestas (0)

Categorías

Más información sobre Software Development Tools en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by