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

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 日

0 投票

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 月 20 日
編集済み: langrg 2020 年 2 月 20 日
In fact I would like to get the handle OR the path of the block...
I want to know which block is linked to the Matlab-Function code executed.
Fangjun Jiang
Fangjun Jiang 2020 年 2 月 20 日
would you try to see if "gcb" could always give you the correct path?
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 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

製品

リリース

R2018b

質問済み:

2020 年 2 月 20 日

コメント済み:

2020 年 2 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by