Simulink : Get handle of a Matlab-Function block, inside Matlab-Function itself

2 次查看(过去 30 天)
Hello,
Is there a way to get handle of a Matlab-Function Simulink block inside of the Matlab-Function itself?
Thanks!

采纳的回答

Fangjun Jiang
Fangjun Jiang 2020-2-20
I would think so, just try handle=get_param(Block,'handle') where "Block" is the full path of the MATLAB function block in your Simulink model.
  3 个评论
langrg
langrg 2020-2-21
It works! I thougth that 'gcb' would change each time I select a bloc in Simulink, but in fact when it's used in Matlab-Function it always gives back Matlab-Function path.
I'm going to accept your answer and write solution in capital here:
USE "gcb" IS THE GOOD SOLUTION!
Thank you very much!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by