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

3 visualizaciones (últimos 30 días)

Respuesta aceptada

Abhishek GS
Abhishek GS el 6 de Abr. de 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

Más respuestas (0)

Categorías

Más información sobre Interactive Model Editing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by