How can I acquire the calling function in an object?

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.

 Réponse acceptée

Look at the "dbstack" object:
callingStack = dbstack

3 commentaires

Zoltán Csáti
Zoltán Csáti le 4 Jan 2015
Modifié(e) : Zoltán Csáti le 4 Jan 2015
It seems to have a debug tool. Is it safe to use it for non-debugging purposes?
Of course. Just treat it like any other variable.
Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by