正在加载图片...
set(O, DefaultFigurePaperOrientation,, value) set(Hf, "PaperOrientation,, value) elseif Name(1)==t set(O, DefaultFigurePaper Type, value) set(Hf, " Paper Type, value elseif Name(1)==u set(O, DefaultFigurePaper Units, value) set(Hf, Paper Units', value) disp(l 'Unknown Property Name: Name)) 当把对象放在一个特定的位置时,有时在象素和归一化坐标之间进行转化是很有用的。在 精通MA∏LAB工具箱中有两个函数进行这种转换。第一个是mmpx2n,它将象素转化为归 化坐标;第二个是mmn2px,它进行相反的转换。这些函数演示了如何以所需的一组单位获取 Position’属性值。首先,把对象的当前" Units属性保存起来:;然后,将" Units'属性设成所 需的值并获取所需的 Position’属性值;最后,将Unis'的值恢复为初始值。mmpx2n的M 文件描述如下: function Y=mmpx2n(X, Hf %MMPX2N Pixel to Normalized Coordinate Transformation MMPX2N(X)converts the Position vector x from pixel coordinates to normalized coordinates w r.t. the computer screen MMPX2N converts the Position vector X from pixel coordinate to narmalized coordinates w.r. t the figure window having handle H % X=lleft bottom width height] or X=width height Copyright (c) 1996 by Prentice-Hall, Inc msg=Input is not a pixel Position vector length(X) if nargin==l, Hf=0 SZ="ScreenSize; end if any (X<l)l(lx-=4&lx-=2)set(0, ‘DefaultFigurePaperOrientation’ ,value) set(Hf, ‘PaperOrientation’ ,value) elseif Name(1)== ‘t’ set(0, ‘DefaultFigurePaperType’ ,value) set(Hf, ‘PaperType’ ,value) elseif Name(1)== ‘u’ set(0, ‘DefaultFigurePaperUnits’ ,value) set(Hf, ‘PaperUnits’ ,value) else disp([ ‘Unknown Property Name:’ Name]) ens end end 当把对象放在一个特定的位置时,有时在象素和归一化坐标之间进行转化是很有用的。在 精通 MATLAB 工具箱中有两个函数进行这种转换。第一个是 mmpx2n,它将象素转化为归一 化坐标;第二个是 mmn2px,它进行相反的转换。这些函数演示了如何以所需的一组单位获取 ‘Position’ 属性值。首先,把对象的当前 ‘Units’ 属性保存起来;然后,将 ‘Units’ 属性设成所 需的值并获取所需的 ‘Position’ 属性值;最后,将 ‘Units’ 的值恢复为初始值。mmpx2n 的 M 文件描述如下: function Y=mmpx2n(X,Hf) %MMPX2N Pixel to Normalized Coordinate Transformation. % MMPX2N(X) converts the Position vector X from pixel coordinates to normalized % coordinates w.r.t.the computer screen. % % MMPX2N converts the Position vector X from pixel coordinate to narmalized coordinates % w.r.t.the figure windoiw having handle H. % % X=[left bottom width height] or X=[width height] % Copyright (c) 1996 by Prentice-Hall,Inc. msg= ‘Input is not a pixel Position vector.’ ; lx=length(X); sz= ‘Position’ ; if nargin==1,Hf=0;sz= ‘ScreenSize’ ;end if any(X<1)| (lx~=4&lx~=2) error(msg)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有