Get Simulink Block name from Callback function

1 次查看(过去 30 天)
In Simulink, is there any way to get the name of the block whose callback function is invoked, from within the function itself? Some functionality similar to the 'this' pointer in C++?

采纳的回答

Arun
Arun 2013-8-2
I figured out that it was possible to do this using the "gcb" handle. So for getting the block's full name, all I had to do was:-
dev = sprintf('%s/%s',get_param(gcb, 'Parent'), get_param(gcb, 'Name'))
Hope this helps anyone else stuck with the same problem as I was.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by