Assigning figure size to a figure with a given handle (MATLAB)

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-04-07T14:15:43Z Indexed on 2010/04/07 14:33 UTC
Read the original article Hit count: 334

Filed under:
|

Hi,

is there a way to assign the outerposition property of a figure to a figure with a given handle?

For example, if I wanted to define a figure as say figure 1, I would use:

 figure(1)
 imagesc(Arrayname) % I.e. any array

I can also change the properties of a figure using the code:

figure('Name', 'Name of figure','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]);

Is there a propertyname I can use to assign the outerposition property to the figure assigned as figure 1?

The reason I am asking this is because I am using a command called save2word (from the MATLAB file exchange) to save some plots from a function I have made to a word file, and I want to limit the number of figures I have open as it does this.

The rest of the code I have is:

plottedloops = [1, 5:5:100]; % Specifies which loops I want to save


GetGeometry = getappdata(0, 'GeometryAtEachLoop') % Obtains a 4D array containing geometry information at each loop


NumSections = size(GetGeometry,4); %Defined by the fourth dimension of the 4D array

for j = 1:NumSections
    for  i = 1:plottedloops
    P = GetGeometry(:,:,i,j);

    TitleSize = 14;
    Fsize = 8;
    % Save Geometry

    scrsz = get(0,'ScreenSize'); %left, bottom, width height   


  figure('Name', 'Geometry at each loop','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]); This specifies the figure name, dims etc., but also means multiple figures are opened as the command runs.

% I have tried this, but it doesn't work:
% figure(0, 'OuterPosition',[scrsz(1) scrsz(2) 700 700]);

    imagesc(P), title('Geometry','FontSize', TitleSize), axis([0 100 0 100]);

    text(20,110,['Loop:',num2str(i)], 'FontSize', TitleSize); % Show loop in figure
    text(70,110,['Section:',num2str(j)], 'FontSize', TitleSize);% Show Section number in figure

    save2word('Geometry at each loop'); % Saves figure to a word file

end

end

Thanks

© Stack Overflow or respective owner

Related posts about matlab

Related posts about figures