time | Calls | line |
---|
| | 1 | function hh = title(varargin)
|
| | 2 | %TITLE Graph title.
|
| | 3 | % TITLE('text') adds text at the top of the current axis.
|
| | 4 | %
|
| | 5 | % TITLE('text','Property1',PropertyValue1,'Property2',PropertyValue2,...)
|
| | 6 | % sets the values of the specified properties of the title.
|
| | 7 | %
|
| | 8 | % TITLE(AX,...) adds the title to the specified axes.
|
| | 9 | %
|
| | 10 | % H = TITLE(...) returns the handle to the text object used as the title.
|
| | 11 | %
|
| | 12 | % See also XLABEL, YLABEL, ZLABEL, TEXT.
|
| | 13 |
|
| | 14 | % Copyright 1984-2019 The MathWorks, Inc.
|
| | 15 |
|
| | 16 | % if the input has a title property which is a text object, use it to set
|
| | 17 | % the title on.
|
| | 18 |
|
< 0.001 | 10 | 19 | if nargout>0
|
| | 20 | [isaxarr,hh]=matlab.graphics.chart.internal.objArrayDispatch(@title,varargin{:});
|
< 0.001 | 10 | 21 | else
|
0.005 | 10 | 22 | isaxarr=matlab.graphics.chart.internal.objArrayDispatch(@title,varargin{:});
|
< 0.001 | 10 | 23 | end
|
< 0.001 | 10 | 24 | if isaxarr
|
| | 25 | return
|
< 0.001 | 10 | 26 | end
|
| | 27 |
|
0.002 | 10 | 28 | [ax,args,nargs] = labelcheck('Title',varargin);
|
| | 29 |
|
< 0.001 | 10 | 30 | if nargs == 0 || (nargs > 1 && (rem(nargs-1,2) ~= 0))
|
| | 31 | error(message('MATLAB:title:InvalidNumberOfInputs'))
|
< 0.001 | 10 | 32 | end
|
| | 33 |
|
< 0.001 | 10 | 34 | if isempty(ax)
|
< 0.001 | 10 | 35 | ax = gca;
|
| | 36 | % Chart subclass support
|
| | 37 | % Invoke title method with same number of outputs to defer output arg
|
| | 38 | % error handling to the method.
|
< 0.001 | 10 | 39 | if isa(ax,'matlab.graphics.chart.Chart')
|
| | 40 | if(nargout == 1)
|
| | 41 | hh = title(ax,args{:});
|
| | 42 | else
|
| | 43 | title(ax,args{:});
|
| | 44 | end
|
| | 45 | return
|
< 0.001 | 10 | 46 | end
|
< 0.001 | 10 | 47 | end
|
| | 48 |
|
< 0.001 | 10 | 49 | string = args{1};
|
< 0.001 | 10 | 50 | if isempty(string), string=''; end
|
< 0.001 | 10 | 51 | pvpairs = args(2:end);
|
| | 52 |
|
| | 53 | % get-set does not support strings as of now
|
0.001 | 10 | 54 | pvpairs = matlab.graphics.internal.convertStringToCharArgs(pvpairs);
|
| | 55 |
|
| | 56 | %---Check for bypass option
|
< 0.001 | 10 | 57 | if isappdata(ax,'MWBYPASS_title')
|
| | 58 | h = mwbypass(ax,'MWBYPASS_title',string,pvpairs{:});
|
| | 59 |
|
| | 60 | %---Standard behavior
|
< 0.001 | 10 | 61 | else
|
0.002 | 10 | 62 | matlab.graphics.internal.markFigure(ax);
|
0.457 | 10 | 63 | h = get(ax,'Title');
|
| | 64 |
|
0.008 | 10 | 65 | set(h, 'String', string, pvpairs{:});
|
| | 66 |
|
< 0.001 | 10 | 67 | end
|
| | 68 |
|
< 0.001 | 10 | 69 | if nargout > 0
|
| | 70 | hh = h;
|
< 0.001 | 10 | 71 | end
|
Other subfunctions in this file are not included in this listing.