Borrar filtros
Borrar filtros

How to pass Buttondwn function output parameter

3 visualizaciones (últimos 30 días)
Mathew Thomas
Mathew Thomas el 26 de Jul. de 2017
Editada: Walter Roberson el 26 de Jul. de 2017
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Jul. de 2017
Editada: Walter Roberson el 26 de Jul. de 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);

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by