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

1 vue (au cours des 30 derniers jours)
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 commentaires
Benjamin Thompson
Benjamin Thompson le 29 Juil 2022
Can you attach an example model showing the problem?
Pascal Knappe
Pascal Knappe le 29 Juil 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".

Connectez-vous pour commenter.

Réponse acceptée

Pascal Knappe
Pascal Knappe le 22 Août 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!

Plus de réponses (0)

Catégories

En savoir plus sur Software Development Tools dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by