From: Walter Roberson on 27 May 2010 14:46 Corey Kelly wrote: > I understand what you mean, but I'm not sure I understand your solution. > What is the figure number? I can't find anything about it in the > documentation. The figure number is the integer number that acts as a handle for the figure. gcf() But Steve's solution of using guidata(src) is much better. > Also, if I pass down the figure number, then define handles in the > callback, does that mean that I don't have to pass handles to the > function? i.e.: > set(handles.currimage,'ButtonDownFcn',@(src,eventdata)axes1_ButtonDownFcn(src,eventdata)); Why bother? Why not just use set(handles.currimage, 'ButtonDownFcn', {@axes1_ButtonDownFcn}) Your anonymous function already assumes that it will be passed two parameters, and those are the same two parameters that need to be passed to axes1_ButtonDownFcn and the same order, so using the anonymous function just adds overhead and complexity and opportunity for mistakes.
From: Corey Kelly on 27 May 2010 22:44
"us " <us(a)neurol.unizh.ch> wrote in message <htllis$lb2$1(a)fred.mathworks.com>... > "Corey Kelly" > > > set(handles.currimage, 'ButtonDownFcn',@axes1_ButtonDownFcn); > > Also, us, could you clarify what you mean by the "final handles"? I thought I was passing all handles to the callback. > > well... to solve the conundrum, you could try this... > > % edit your function > % search the callback subroutine > % put a KEYBOARD statement before the first line of code > % run the gui > % click... > % now inspect all the inputs > > us Alright, I've solved this one! I'm now getting exactly what I was looking for. Every time I click, the set of coordinates is appended to handles.coords. Now I can move on to other issues. Big thanks to Steve, us, and especially Walter for the help. |