Azzera filtri
Azzera filtri

How to pass Buttondwn function output parameter

3 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Walter Roberson
Walter Roberson il 26 Lug 2017
Modificato: Walter Roberson il 26 Lug 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);

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by