# Illustrating some problems with ui* functionality # by Martin Kunz, 14/10/16 1; function updateFigure (source) h = guidata (gcbf); xR = range (h.xLMax) / get (h.zoomS, "value"); xLNew(1) = mean (h.xLMax) - xR/2; xLNew(2) = mean (h.xLMax) + xR/2; xlim (h.hAx, xLNew); endfunction # Produce plot x = linspace (0,10*pi,100); y = sin (x); h = []; h.hFig = figure (1); set (h.hFig, "position", [1 49 1920 979]) %Fullscreen on my main monitor plot (x,y); h.hAx = gca; set (h.hAx, "position", [.13 .2 .83 .7]) h.xLMax = xlim; # Make zoom slider h.zoomS = uicontrol ("style", "slider", "min", 1, "max", 10, "value", 1, "units", "normalized", "position", [.2,0.07,.6,.05], "callback",@updateFigure); # Store GUI data guidata (h.hFig, h);