[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
who called me?
From: |
John W. Eaton |
Subject: |
who called me? |
Date: |
Wed, 22 Oct 2008 11:30:06 -0400 |
On 22-Oct-2008, Søren Hauberg wrote:
| Assuming I have a function 'f1', how can I get the name of whatever
| function called 'f1'?
| I've tried to do this with a combination of 'evalin' and 'mfilename':
|
| function f1 ()
| who_called_me = evalin ('caller', 'mfilename ()')
| end
|
| but that just gives me the name of 'f1'.
With the current development sources, you can use
function f1 ()
x = dbstack ();
if (numel (x) > 1)
caller = x(2).name
else
caller = "base"
endif
endfunction
jwe
- who called me?, Søren Hauberg, 2008/10/22
- who called me?,
John W. Eaton <=