mouse click on simulink block

조회 수: 7 (최근 30일)
Murali Mohan
Murali Mohan 2012년 1월 16일
답변: Pragna Mouli Damera 2019년 8월 19일
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.

답변 (3개)

TAB
TAB 2012년 1월 16일
  1. Right-Click on the simulink block.
  2. Select Block Properties
  3. In the properties dialog select Callback tab
  4. Select OpenFun in the callback function list
  5. Write your m-file function call (or script name) in the textbox.
  6. 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
TAB
TAB 2012년 1월 17일
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
Murali Mohan 2012년 1월 17일
thanks for the reply,
it works for double click, i need it for single click.

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


Pascal Greter
Pascal Greter 2017년 11월 3일
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
Pragna Mouli Damera 2019년 8월 19일
mdl=mdlname;
blk=[mdl,'/blkname'];
set_param(blk, 'Selected', 'on')
It will work as single click like selecting the particuler block.
Hope this helps.

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by