sizefig.m

来自「这是一个很适合研究和学习用的电力系统仿真软件」· M 代码 · 共 49 行

M
49
字号
function pos = sizefig(dx,dy)
% FIGSIZE determine the figure size for the current screen resolution
%
% SIZES = SIZEFIG(DX,DY)
%     DX    = normalized width for a 1024x768 screen
%     DY    = normalized hight for a 1024x768 screen
%     POS = resulting figure normalized position [x y dx dy]
%
%Author:    Federico Milano
%Date:      22-Sep-2003
%Version:   1.0.0
%
%E-mail:    fmilano@thunderbox.uwaterloo.ca
%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano

if ~strcmp(get(0,'Units'),'pixels')
  set(0,'Units','pixels')
end

% get screen size

scrnsize = get(0,'ScreenSize');
screenx = scrnsize(3);
screeny = scrnsize(4);
screenr = screeny/screenx;

% check screen ratio
% standard screen ratio 768/1024 = 0.75

if screenr > 0.75
  screeny = screenx*screenr;
elseif screenr < 0.75
  screenx = screeny/screenr;
end

% changes apply only if the screen resolution is higher than
% 1024x768

if screenx > 1024 | screeny > 768
  dx = 1024*dx/screenx;
  dy =  768*dy/screeny;
end

% output window position

pos = [(1-dx)*0.5, (1-dy)*0.5, dx, dy];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?