Toggle manual switch through m-file script

조회 수: 10 (최근 30일)
Eduardo Rey
Eduardo Rey 2012년 4월 24일
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?

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 4월 24일
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
Chetan Sharma
Chetan Sharma 2018년 8월 23일
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 2022년 5월 20일
편집: Sergio Enrique Pinto Castillo 2022년 5월 20일
How did you change the position of the toggle swicth using the value of output in a simulink block?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by