Borrar filtros
Borrar filtros

Get Simulink Block name from Callback function

1 visualización (últimos 30 días)
Arun
Arun el 2 de Ag. de 2013
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++?

Respuesta aceptada

Arun
Arun el 2 de Ag. de 2013
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.

Más respuestas (0)

Categorías

Más información sobre Model, Block, and Port Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by