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.

 채택된 답변

Image Analyst
Image Analyst 2015년 1월 4일
Look at the "dbstack" object:
callingStack = dbstack

댓글 수: 3

Zoltán Csáti
Zoltán Csáti 2015년 1월 4일
편집: Zoltán Csáti 2015년 1월 4일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Execution Speed에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by