有没有一种方法可以将一个给定句柄的图形的outerposition属性分配给一个图形?
例如,如果我想将一个图形定义为figure 1,我会使用:
figure(1)
imagesc(Arrayname) % I.e. any array
我可以使用代码更改图形的属性:
figure('Name', 'Name of figure','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]);
有没有一种属性名称可以用来将outerposition属性分配给作为figure 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
结束
谢谢
figH = findall(0,'tag','mySpecificFigureHandle')
来具体访问图形。 - JonashandleVisibility
设置为false
,并且只通过标签来寻址图形。存储图形 handle 的属性会成为一个依赖属性,并有一个 get 方法,(1) 检查现有的 handle (存储在隐藏属性中) 是否过时,(2) 如果是,则生成一个新的 figure。 - Jonas