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 日

0 投票

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?
Image Analyst
Image Analyst 2015 年 1 月 4 日
Of course. Just treat it like any other variable.
Zoltán Csáti
Zoltán Csáti 2015 年 1 月 5 日
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by