Can't resize shape anymore, just width

I am creating about 1000 videos in a loop with Matlab. The videos contain a 1000x1000 pixel figure with changing graphics inside, initiated by

h=figure('units','pixels','Position',[0 0 1000 1000])

      

Each video contains about ~ 20-200 frames, each shape consists of 5 subtasks and a text field ( here is an example of one frame ).

Everything works great for about 800 videos (inside a loop) when suddenly the size of one shape's figure is only 1000 * 999 pixels. When this error occurs I tried to resize the height, but it works. Neither by dragging the window nor by code:

set(gcf, 'Units', 'pixels','Position',[0 0 1000 1000])

      

But I can change the size. Does anyone know what might be causing this problem?

EDIT: When I use opengl software

it everything works fine, but the quality is nowhere near that good.

Main loop (I tried to shorten as much as possible):

   for i=1:length(idx) %loop over video
            %Create figure and title
            fh=figure('units','pixels','Position',[0 0 1000 1000])

            subQ=subplot_tight(3,2,[1,2])
            p_Q=plot(Q_time_num(idx_Q(i,1):idx_Q(i,2)), Q(idx_Q(i,1):idx_Q(i,2)),...
                Q_time_num(idx_Q(i,1):idx_Q(i,2)), Q_trunc(idx_Q(i,1):idx_Q(i,2)),'--')

            an_tit=annotation('textbox',[0.48 0.89 0.1 0.1],'String',tit_string)
            set(an_tit, 'horizontalAlignment', 'center')

            for i_s = 1:numel(ind) %loop over each frame

                for ii=1:4length(fieldnames(Data)) %loop over the 4 subplots
                    if i_s==1
                        sub_p(ii)=subplot_tight(3,2,ii+2)
                        h1(ii)=plot(bord(:,2),bord(:,1),'color','k','linewidth',2,'Parent',sub_p(ii));
                        c(ii)=colorbar;

                        title([infos{ii,3},' - [',infos{ii,2},']'],'Interpreter','none')
                        hold on;
                        p(ii)=scatter(bord(cc,2),bord(cc,1),'MarkerEdgeColor',[0 0 0],...
                            'MarkerFaceColor',[0 0 0],'LineWidth',2,'Parent',sub_p(ii));
                        hold off;
                    end

                    hold on
                 [C,h2(ii)]=contourf(longitude,latitude,rot90(flipud(temp)),'Parent',sub_p(ii)) ;
                    clabel(C,h2(ii))
                    set(sub_p(ii),'Position',A(ii+1,:));
                    set(gcf, 'color', 'white');
                    uistack(h1(ii),'up',3)
                    uistack(p(ii),'up',3)
                end
                moving_img %save figure as frame
                delete(line_Q);delete(h2(:)); delete(text_an)
            end
            close all
        end

      

+3


source to share





All Articles