link to a m-file from Simulink model

조회 수: 4 (최근 30일)
cyberdyne
cyberdyne 2011년 9월 23일
댓글: Faisal Ahmed 2017년 9월 6일
Hi,
How can I place a box with the link to a m-file into a Simulink model like those of S-function examples ?
Thanks
  댓글 수: 4
Fangjun Jiang
Fangjun Jiang 2011년 9월 25일
What do you mean "link"? What do you try to do? There is a way to run a .m file when you double-click a block in the Simulink model. But that is not the case for sfundemos.mdl. It's just a library with subsystem hierarchy.
Faisal Ahmed
Faisal Ahmed 2017년 9월 6일
Hello can you please tell me how can i run .m file when i double clicl a simulink model.

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

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2011년 9월 26일
I think the links in the S-function demos are basically empty subsystems with the OpenFcn block callback defined so as to open the corresponding MATLAB file. You can drag a Subsystem block, delete its contents so the input/output ports disappear. Then right-click on the block, select "Block Properties" and under the Callbacks->OpenFcn pane, enter "edit mymatlabfile.m". This should do the trick.
The other technique as Alessandro mentioned is to create an annotation and define it's ClickFcn as "edit mymatlabfile.m".
  댓글 수: 1
cyberdyne
cyberdyne 2011년 9월 29일
Thanks for reply,
I thought 'annotation properties' setting was the easiest method.
I'll try with OpenFnc.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by