Creating and closing figure takes a really long time
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Hello
I have a simple class which creates an uifigure with a grid, a couple of panels and multiple axes:
classdef multiChanFig < handle
    properties
        f
        panelU
        axesU = gobjects(2,0);
        panelT
        axesT = gobjects(0);
        shownCh = [];
        titles = [];
    end
    methods
        function obj = multiChanFig(shownCh)
            obj.f = uifigure('Position',[50,50,1800,900]);
            g = uigridlayout(obj.f);
            g.RowHeight = repmat({'1x'},[1,2+length(shownCh)]);
            g.ColumnWidth = repmat({'1x'},[1,length(shownCh)]);
            g.ColumnSpacing = 0;
            g.RowSpacing = 0;
            g.Padding = [0 0 0 0];
            for ii = 1:length(shownCh)
                for jj = 1:2
                    np = uipanel(g);
                    np.BorderType = 'none';
                    np.Layout.Row = jj;
                    np.Layout.Column = ii;
                    obj.panelU(jj,ii) = np;
                    obj.axesU(jj,ii) = axes('Parent',obj.panelU(jj,ii));
                end
                np = uipanel(g);
                np.BorderType = 'none';
                np.Layout.Row = 2+ii;
                if length(shownCh) == 1
                    np.Layout.Column = 1;
                else
                    np.Layout.Column = [1, length(shownCh)];
                end
                obj.panelT(ii) = np;
                obj.axesT = axes('Parent',obj.panelT(ii));
            end
        end
    end
end
I am calling it from command line using:
o = multiChanFig([1,2,3])
It takes so long to "create" (the actual popup is pretty quick but then the axes limits/ticks auto-adjusting to the size of the window takes a looong time) and when I click on the X to exit the figure it takes 20+ seconds are you can see from this profiler:

Vast majority of the slowdown comes from Matlab figure processes it seems, with the biggest offenders being ControlManager.sendControlManagerMessage and InteractionsManager.sendInteractionsManagerMessage. These are both P-files so I cannot even see why it takes so long to do such simple operations.
Has anyone else encountered this? Any advice? Thanks
Antworten (0)
Siehe auch
Kategorien
				Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
