精通MATLAB的Chap214.docVIP

  • 7
  • 0
  • 约2.03万字
  • 约 15页
  • 2017-03-06 发布于重庆
  • 举报
精通MATLAB的Chap214

set(gco, Units , data ,... HorizontalAlignment , left ,... mmdraw是精通MATLAB工具箱中另一个有用GUI函数,它与mmtext十分相似,但更为复杂,此函数允许用户用鼠标在当前的坐标轴上画线并设置线的属性。 function mmdraw(arg1,arg2,arg3,arg4,arg5,arg6,arg7) %MMDRAW Draw a Line and Set Properties Using Mouse. %MMDRAW Draw a Line in the current axes using to the mose. %Click at the starting point and drag to the end point %In addition,properties can be given to the line. %Properties are given in pairs,e.g.,MMDRW name vale... %Properties: %NAME VALUE (defult) %color [y m c r g b {w} k] or an rgb in quotes: [r g b] %style [-----{:}--.] %mark [0 + . * x] %width points for linewidth {0.5} %size points for marker size {6} %Examples: %MMDRAW color r width 2 sets color to red and width to 2 points%MMDRAW mark + size 8 set marker type to +and size to 8 points %MMDRAW color [1 5 0] set color to orange %Copyright (c) 1996 by Prentice-Hall,Inc. global MMDRAW_Hl MMDRAW_EVAL if nargin==0 arg1= color ;arg2= w ;arg3= style ;arg4= : ;nargin=4; end if isstr(arg1) % initial call,set thing up if isempty(Hf),error( No Figure Available. ),end Ha=findobj(Hf, Type, axes ); if isempty(Ha),error( No Axes in Current Figure. ),end set(Hf, Pointer , Crossh ,...%set up callback for line star BackingStore , off ,... WindowButtonDownFcn , mmdraw(1) ) figure(Hf) MMDRAW_EVAL= mmdrw(99);%set up string to set attributes for i=1:nargin argi=eval(sprintf( arg%.of ,i)); MMDARW_EVAL=[MMDARW_EVAL , arg ]; end MMDARW_EVAL=[MMDARW_EVAL ,) ]; elseif arg1==1 % callback is line start point fp=get(gca, CurrentPoint ); %start point set(gca, Userdata ,fp(1,1:2)) %store in axes userdata set(gcf, WindowButtonMotionFcn , mmdraw(2) ,...

文档评论(0)

1亿VIP精品文档

相关文档