Borrar filtros
Borrar filtros

How can I acquire the calling function in an object?

16 visualizaciones (últimos 30 días)
Hello everyone,
I have a class that has several methods. How can I access the name of a specific method (function) in another method? For example, let's assume that I have 3 method functions: fun1, fun2 and fun3. In fun1 and in fun2 I call fun3. In fun3 I want to know by which function it was invoked: fun1 or fun2? How can I achieve it?
Thank you.

Respuesta aceptada

Image Analyst
Image Analyst el 4 de En. de 2015
Look at the "dbstack" object:
callingStack = dbstack
  3 comentarios
Image Analyst
Image Analyst el 4 de En. de 2015
Of course. Just treat it like any other variable.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by