[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Identifying the name of a parent function in a child function?
From: |
David Bateman |
Subject: |
Re: Identifying the name of a parent function in a child function? |
Date: |
Fri, 25 Apr 2008 09:33:06 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080306) |
Thomas Treichl wrote:
> Hi,
>
> I'm currently playing with some algorithms and what I could need now that
> would be a way to find out which, let's say, 'parent function' called my
> 'child
> function'. Is there a way to do that by not passing an ID-variable from the
> parent to the child (eg. like dbstack works in Matlab) and by not setting a
> global or persistent variable before?
>
> What I mean by example
>
> function [] = funA ()
> funC;
> endfunction
>
> function [] = funB ()
> funC;
> endfunction
>
> function [] = funC ()
> # Did funA or funB call me?
> endfunction
>
> Thanks,
>
> Thomas
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>
I would have thought that something like
function y = funA (), y = funC; endfunction
function y = funB (), y = funC; endfunction
function y = funC (), y = evalin ("caller", "mfilename()"); endfunction
should have worked, but it doesn't appear to.
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary