Clear Filters
Clear Filters

How to pass Buttondwn function output parameter

3 views (last 30 days)
Dear All,
How can I pass an output parameter for buttondownfcn?
set(handles.b,'ButtonDownFcn', {@displayMontage, handles});
function curwell = displayMontage(src, evt, handles)
curwell = get(gco,'position');
handles = updateVisCircleColor(curwell(1), curwell(2), 'red', handles);
I want to pass "curwell" back to the initial function call. How can this be done?
Thanks,
Mathew

Accepted Answer

Walter Roberson
Walter Roberson on 26 Jul 2017
Edited: Walter Roberson on 26 Jul 2017
If by "initial function call" you mean the call
set(handles.b,'ButtonDownFcn', {@displayMontage, handles});
that configured the callback, then the answer is that you cannot do that: that function is probably no longer running, and MATLAB does not keep track of which function or which line of code configured a particular property.
However, you could do something like,
set(handles.b, 'ButtonDownFcn', {@displayMontage, handles}, 'UserData', []);
waitfor(handles.b, 'UserData')
curwell = get(handles.b, 'UserData');
function displayMontage(src, evt, handles)
curwell = get(gco,'position');
handles = updateVisCircleColor(curwell(1), curwell(2), 'red', handles);
set(src, 'UserData', curwell);

More Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!