有没有办法将图形的outerposition属性赋值给具有给定句柄的图形?
例如,如果我想将图形定义为图1,我将使用:
figure(1)
imagesc(Arrayname) % I.e. any array
Run Code Online (Sandbox Code Playgroud)
我还可以使用代码更改图形的属性:
figure('Name', 'Name of figure','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]);
Run Code Online (Sandbox Code Playgroud)
是否有一个属性名称可用于将outerposition属性分配给指定为图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
Run Code Online (Sandbox Code Playgroud)
结束
谢谢
如果您在创建图窗时捕获图窗句柄
figH = figure;
Run Code Online (Sandbox Code Playgroud)
您可以随时分配属性
set(figH,'OuterPosition',[scrsz(1),scrsz(2),700,700]);
Run Code Online (Sandbox Code Playgroud)
您还可以将图形手柄收集在矢量内,然后一次设置所有尺寸。
如果由于某种原因无法捕获图窗句柄,您可以使用findall查找具有特定名称的图窗,或gcf获取当前(上次选择/打开)图窗的句柄。
| 归档时间: |
|
| 查看次数: |
3419 次 |
| 最近记录: |