mouse click on simulink block
Mostrar comentarios más antiguos
Hi, Pls help me on this,
when the mouse is clicked on the simulink block i just want to run any m file from the call backs. help me how to approach.
Respuestas (3)
TAB
el 16 de En. de 2012
3 votos
- Right-Click on the simulink block.
- Select Block Properties
- In the properties dialog select Callback tab
- Select OpenFun in the callback function list
- Write your m-file function call (or script name) in the textbox.
- If your m-file is not located in current directory, then set m-file directory in matlab path. You can set the path in "OpenFun" callback also using addpath() command.
3 comentarios
Titus Edelhofer
el 16 de En. de 2012
Perfect answer. @Murali: note that this is for a "double click" on some simulink block.
TAB
el 17 de En. de 2012
Titus is right. 'OpenFun' callback will execute on double mouse click. I think, there is no callback for single mouse click on simulink blocks.
Murali Mohan
el 17 de En. de 2012
Pascal Greter
el 3 de Nov. de 2017
2 votos
I know, this question was asked quite a while ago, but still the answer might be helpful for whomever.
An easy way to go is using a textblock. Under properties you'll find the 'ClickFcn' which executes on single-click.
Pragna Mouli Damera
el 19 de Ag. de 2019
0 votos
mdl=mdlname;
blk=[mdl,'/blkname'];
set_param(blk, 'Selected', 'on')
It will work as single click like selecting the particuler block.
Hope this helps.
Categorías
Más información sobre Interactive Model Editing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!