有没有办法将图形的外部位置属性分配给具有给定句柄的图形?
例如,如果我想将一个图定义为图 1,我会使用:
figure(1)
imagesc(Arrayname) % I.e. any array
我还可以使用以下代码更改图形的属性:
figure('Name', 'Name of figure','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]);
是否有一个属性名可以用来将外部位置属性分配给分配为图 1 的图形?
我问这个的原因是因为我正在使用一个名为 save2word 的命令(来自 MATLAB 文件交换)将一些绘图从我制作的函数保存到 word 文件中,并且我想限制我打开的图形数量它这样做。
我剩下的代码是:
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
结尾
谢谢