How do I create an On/Off button in Simulink with a clickfcn from an annotation
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marco Le Donne
am 24 Jan. 2018
Kommentiert: Marco Le Donne
am 5 Feb. 2018
Hi, I created on Simulink a clickfcn from an annotation to comment out a block. Now I want to uncomment the block with a second click on the annotation clickfcn. Also the background color from the annotation should change to: green = comment out and red = uncomment.
0 Kommentare
Akzeptierte Antwort
Gaurav Phatnani
am 1 Feb. 2018
You can use an annotation to comment and uncomment a block by enterting the code below as the 'ClickFcn' for the annotation.
if(strcmp(get_param(path_to_block,'Commented'),'on'))
set_param(path_to_block,'Commented','off');
else
set_param(path_to_block,'Commented','on');
end
Unfortunately, annotation properties can not be accessed programatically and hence, you will not be able to change the color of the annotation based on whether the block is commented or not.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!