code generation with do not using temp local variable
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
TaeHee Kwun
le 4 Juin 2019
Commenté : Nick Sarnie
le 5 Juin 2019
I try to use multy operation sentence in stateflow.
And I generate this code, it makes temp variable.
example of sentence is ' input = KTH / HJY * JSM ' .
And it brings
rtb_Gain1_h = KTH / HJY; ( rtb_Gain1_h is autmatically generated Local variable )
input = rtb_Gain1_h * JSM;
I want to use this sentence in once like ' input = KTH / HJY * JSM '
I tried to change optimize setting not to 'Enable local block ouputs' it works but other code are affectted to be bad readabillity.
Isn't no way to remove any of not intended local variable?
Thank you.
0 commentaires
Réponse acceptée
Nick Sarnie
le 5 Juin 2019
Modifié(e) : Nick Sarnie
le 5 Juin 2019
Hi TaeHee,
It is unlikely that you will be able to control the optimization to this level of detail. If you prefer the temporary variable to be removed, please 'Enable local block outputs' option. There is often a tradeoff between performance and readability in many areas of computing.
Thanks,
Nick
2 commentaires
Nick Sarnie
le 5 Juin 2019
Hi TaeHee,
If global variables are your concern, you can tell the code generator to try to avoid them. Please see the below doc link:
Thanks,
Nick
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!