How to pass Buttondwn function output parameter

3 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2017-7-26
编辑:Walter Roberson 2017-7-26
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by