Effacer les filtres
Effacer les filtres

[Simulink] Not to process for a period of time

1 vue (au cours des 30 derniers jours)
Georgiy
Georgiy le 9 Juin 2014
Commenté : Georgiy le 13 Juin 2014
Hello, I have a MATLAB function block takes an input value (one per second) and after some calculations outputs it. How I force this block to stop outputting the signals for a given period of time? Let's say I have a signal:
[1,2,3,4,5,6,7,8,9,10]
And code outputs values larger than 3. I need it to stop outputting for 2 seconds if it indeed finds value larger than 3. So without output stopping, this block will output:
[4,5,6,7,8,9,10]
because these are indeed larger than 3. I need it to output:
[4,7,10]
i.e. it finds value larger than 3, then stops outputting for 2 iterations (2 seconds) and continues.
Thank you!

Réponse acceptée

Philipp Maier
Philipp Maier le 12 Juin 2014
I can think of one way that might solve this:
Inside the MATLAB Function Block, you could define a persistent variable. The variable would allow you to retain it's value in memory between calls to the function. In other words, you will be able to use this variable to count the two seconds after your output was larger than 3. For example:
  1 commentaire
Georgiy
Georgiy le 13 Juin 2014
Thank you very much! It works!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by