⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 label.m

📁 realize analysis and design for computer-controlled system
💻 M
字号:
     function handle = label(lab,ax)     % LABEL: Places an axis label or title that can be      % controlled by the user.     %     % LABEL(LAB) uses the text contained in LAB as the      % X-axis label.     %     % LABEL(LAB,AX) labels the axis or title defined by AX.     % AX can be one of the following:     %     % 'x' or 'X'      ==>     X-axis     % 'y' or 'Y'      ==>     Y-axis     % 'z' or 'Z'      ==>     Z-axis     % 't' or 'T'      ==>     Title     %     % HANDLE = LABEL(...) returns the handle to the label.     %     % EXAMPLES:     %   >> label('X-Axis','x')     %   >> label('Y-Axis','y')     %   >> label('Z-Axis','z')     %   >> label('Title','t')     %     % SEE ALSO: text, title, xlabel, ylabel, and zlabel     if nargin == 1       ax = 'x';     end     if ~isstr(lab) | ~isstr(ax)       error('Inputs must be a string variable')     end     % Determine the axis or title to be labeled     if strcmp(ax,'x') | strcmp(ax,'X')       H = get(gca,'xlabel');     elseif strcmp(ax,'y') | strcmp(ax,'Y')       H = get(gca,'ylabel');     elseif strcmp(ax,'z') | strcmp(ax,'Z')       H = get(gca,'zlabel');     elseif strcmp(ax,'t') | strcmp(ax,'T')       H = get(gca,'title');     else       error('Invalid axis')     end     % Replace the axis label or title with a TEXT string     T = text('color',         get(H,'color'), ...         'erasemode',          get(H,'erasemode'), ...         'fontangle',          get(H,'fontangle'), ...         'fontname',           get(H,'fontname'), ...         'fontsize',           get(H,'fontsize'), ...         'fontweight',         get(H,'fontweight'), ...         'horizontalalign',    get(H,'horizontalalign'), ...         'position',           get(H,'position'), ...         'rotation',           get(H,'rotation'), ...         'string',             lab, ...         'units',              get(H,'units'), ...         'verticalalignment',  get(H,'verticalalignment'), ...         'buttondownfcn',      get(H,'buttondownfcn'), ...         'clipping',           get(H,'clipping'), ...         'interruptible',      get(H,'interruptible'),...         'userdata',           get(H,'userdata'), ...         'visible',            get(H,'visible'));     set(T,'units','normal')   % Required for printing     %  Remove the original axis label     delete(H);     % Output     if nargout       handle = T;     end

⌨️ 快捷键说明

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