Effacer les filtres
Effacer les filtres

Initializing some variables in base workspace when running simulink model

11 vues (au cours des 30 derniers jours)
I'd like to initialize some variables in base workspace during initialization phase of simulation in SIMULINK. Is there such a block in SIMULINK doing this or so?
For more clarification I have a user written code in my simulink model applied by using interprete MATLAB Fnc Block in which all the history of the input signal is needed. To solve this I used to assign a vector to the base workspace after adding the block new input value and read that vector in the next loop(I mean next sample time). Now every thing is fine and my model works properly but I've bored initializing that vector in base workspace manually before each simulation. I'd like it to be done automatically. Any suggestion?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 23 Avr 2013
You can use model callbacks and initialize your parameters in init function
  2 commentaires
Pouya Jamali
Pouya Jamali le 24 Avr 2013
Definitely true. Tnx!
Christian
Christian le 19 Déc 2017
In one of the callback function of your model you can use the following command:
assignin('base','TestVar',Value)
To access these callbacks use right click in the background of your model and 'Model Properties...'

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Event Functions dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by