Toggle manual switch through m-file script

9 visualizaciones (últimos 30 días)
Eduardo Rey
Eduardo Rey el 24 de Abr. de 2012
Editada: Sergio Enrique Pinto Castillo el 20 de Mayo de 2022
I want to toggle the manual switch block in Simulink using an m-file script.
....my model file is called "ecg_filter" and the manual switch is called "sw1", so I wrote in the m-file: set_param('ecg_filter/sw1','varsize','off') but the switch did not change positions, what am I doing wrong?

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 24 de Abr. de 2012
The parameter is called 'sw', not 'varsize'. You need to use:
>> set_param('ecg_filter/sw1', 'sw', '0')
>> set_param('ecg_filter/sw1', 'sw', '1')
  4 comentarios
Chetan Sharma
Chetan Sharma el 23 de Ag. de 2018
Hi people. How did you find that the parameter is called 'sw'? I am trying to use same kind of parameter in manual variant sink block but unable to find a parameter for the same. Thank you. :)
Sergio Enrique Pinto Castillo
Sergio Enrique Pinto Castillo el 20 de Mayo de 2022
Editada: Sergio Enrique Pinto Castillo el 20 de Mayo de 2022
How did you change the position of the toggle swicth using the value of output in a simulink block?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by