How to identify a calling function inside a called function?

1 view (last 30 days)
function func3(app)
% Callbacks that handle component events
methods (Access = private)
% Callback function: AbsoluteEditField, ApplyButton,
% RelativeEditField
function ApplyButtonPushed(app, event)
app.EditField.Value = (event.Source.Tag) %% this does not work
if event.source = app.EditField..... %% this works
if event.source = app.func3..... %this does not work
% Value changed function: EditField_2
function EditField_2ValueChanged(app, event)
value = app.EditField_2.Value;
Here is the idea :
editing a textbox calls a function that subsequently calls another function (like a pushed button here). I am not sure how I can execute this and more importantly, how I can know from where the button pushed function was called.
For editfields, the event.Source would have the information, but when called from a function like func3, there is no such information.
How do I access the source or name of the function inside the buttonpushed function in this case??
Biraj Khanal
Biraj Khanal on 16 Mar 2022
Edited: Biraj Khanal on 16 Mar 2022
Can be done two ways :
Inside the value change function of app.EditField , i could call
what I have done here is simply used the existing callback of the button pushed with the app.EditField which apparently sends the event as parameter.
The problem is I can't do:
function func3(app)
Or something to that effect so that I could identify inside the ApplyButtonPushed function where it is triggered from. I want to know that func3 is where the ApplyButtonPushed is called from.
And thanks for pointing out the confusion. I did not include the previous step.

Sign in to comment.

Answers (0)


Find more on Startup and Shutdown in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by