設定グラフ図形
しかし、私は位置を思いやりながら、幅と高さを設定したいだけです。目的の動作は、私がそのような姿を中心にドラッグすることができるが、それぞれの再描画でサイズは固定されるということです。
上記のリンクの方法は好きではありません。この位置に(x、y)座標を提供する必要があります。しかし、おそらくそのset()関数を使用するためのより賢い方法がありますか?
編集:cool @答え以下の答えは、ここに私の更新されました機能です。他のことは「サイレント」になることです。
function h = sfigure(h,s1,s2)
% SFIGURE Create figure window (minus annoying focus-theft).
%
% Usage is identical to figure.
%
% Daniel Eaton, 2005
%
% See also figure
%
% Modified by Peter Karasev, 2012, to optionally set scale
%
if nargin>=1
if ishandle(h)
set(0, 'CurrentFigure', h);
else
h = figure(h);
end
else
h = figure;
end
if( nargin > 1 )
scaleX = s1;
scaleY = s1;
if( nargin > 2 )
scaleY = s2;
end
pos = get(h,'Position');
pos(3:4) = [400 300].*[scaleX scaleY];
set(gcf,'Position',pos);
end
.