I have a function that is called when a user clicks a button on the GUI:
function handles = draw_polygon(handles)
h = impoly; %allow user to draw polygon
fcn = @posChanged;
addNewPositionCallback(h, fcn);
points = h.getPosition;
...
end
function posChanged(pos)
pos %write out for testing
end
posChanged gets called when I move vertices of the polygon, but I cannot save the changes because I do not have access to handles in posChanged. Is there a way to pass handles into posChanged? handles is essentially a place where I store "global" variables in the GUI app.
Ron