Effacer les filtres
Effacer les filtres

Is it possible to toggle a manual switch via pressing a keyboard button in a running Simulink environment?

3 vues (au cours des 30 derniers jours)

Réponse acceptée

Abhishek GS
Abhishek GS le 6 Avr 2015
Hi TZEEEE,
If you are looking to control the 'Manual Switch' via keyboard, I am afraid it is not possible by pressing a simple keyboard button. The closest you get could get to it is by using a 'Switch' block like below.
Now, while this model is running (Lets say Stop Time = inf), on the command line you will have to enter the following commands:
ctrl = 1 % or ctrl = 0
set_param(gcs,'SimulationCommand','Update')
Once, the Simulink Model is updated the new value for the variable 'ctrl' used in the ControlValue constant block takes its effect.
Note that you could also update the model using keyboard shortcut "Ctrl+D".
Thanks, Abhishek

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Model Editing 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!

Translated by