Azzera filtri
Azzera filtri

Reset a simulink function does not work

6 visualizzazioni (ultimi 30 giorni)
Hi everyone,
I experience difficulties when I try to use some Simulink Function in my stateflow. Actually, I have encountered some problem to reset the function I have called in my chart.
For the exemple, I will use a simple counter as my Simulink function. To be more specific, I am calling the Simulink function at two differents times in my chart. But when I call the function for the second time (in state " Neutral_Speed" on the picture), I want that the value of my counter starts from 0 again (like the first time the function was called).
However, even if I set in the block parameter, the option " State when enabling" to reset, the value of my counter does not reset. I success to do this thing with a enabled subsystem but I need to do this in a Simulink Function.
The result I obtained (in red) vs the result I want (in green).
Do you have any idea on how to reset my signal each time I called the Simulink function ?
Please find enclosed a picture to have a better understanding.
Thanks for your help and have a good day !

Risposta accettata

User_in_Gim
User_in_Gim il 16 Mar 2017
Hi,
I have found a way to solve my problem which is related to the scope of the Simulink function-call.
I have to duplicate the bloc and put it in the subchart (or state) where I want to call my function. It's a bit tedious but the job is done.

Più risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by