Simulink: Can you invert the constant block?

is there a way to "invert" the constant block?
As you know, it is possible to name a variable as a value in the constant block, which is then output as a signal. Is it possible to invert this? So enter a signal and write it into the named variable in the workspace?
Thank you!

Réponses (1)

Jonas
Jonas le 23 Sep 2021

0 votes

3 commentaires

Luca FS
Luca FS le 23 Sep 2021
But that only saves timesseries oder structures right? How can I safe a single value to a single variable?
Jonas
Jonas le 24 Sep 2021
The 'To Workspace' block can save into a Timeseries, Array, Structure or Structure with time. It will save this type into the variable 'out' variable by default.
If you want to move the variable from the 'out' structure into the Base Workspace, you will need to use a script to copy the variable.
Since the To Workspace variables only end up in the Base Workspace after the simulation is stopped, this isn't really a hassle I would say.
Jonas
Jonas le 24 Sep 2021
If you want to avoid the To Workspace block logging a lengthy array, you can put the To Workspace block inside a Triggered Subsystem and connect a 'true' to it. Then it will only save one instance of the signal.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Produits

Version

R2021a

Question posée :

le 22 Sep 2021

Commenté :

le 24 Sep 2021

Community Treasure Hunt

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

Start Hunting!

Translated by