Hi all I need to process some data that are presented in figure, using KeyReleaseFcn function and than draw result in new figure. Structure of code is following:
h = figure('KeyReleaseFcn',@whatPressed); ... function whatPressed(src,evnt) ... ShowPlane(iZ,iG);
if strcmp(evnt.Modifier,'control') && strcmp(evnt.Key,'uparrow') DoSomeCalculations xzFig = figure; pcolor(X,Z,XZ); ... end % of if
function ShowPlane(iZ,iG) ... wrkFgr = imagesc(Y,X, yxCross); ... end % of ShowPlane
end % of whatPressed
Problem is localized in line "xzFig = figure;" When I run this function a few first times it works correctly, but than new figure (xzFig) copy content of original figure (wrkFig) that is drawn by ShowPlane function. Under debugger I see that this happens in line "xzFig = figure;": new figure window is not empty but repeat content of wrkFig figure from ShowPlane.
Exchange this line by "figure;" do not change function's behavior.
Exchange it by "xzFig = newplot" with or without parameters gives again copy of original figure (wrkFig) immediately.
What is wrong, how I can have correct function reaction?