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-2017 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.
|
0.002 | 2 | 18 | [ax,args,nargs] = labelcheck('Title',varargin);
|
| | 19 |
|
< 0.001 | 2 | 20 | if nargs == 0 || (nargs > 1 && (rem(nargs-1,2) ~= 0))
|
| | 21 | error(message('MATLAB:title:InvalidNumberOfInputs'))
|
| | 22 | end
|
| | 23 |
|
< 0.001 | 2 | 24 | if isempty(ax)
|
< 0.001 | 2 | 25 | ax = gca;
|
| | 26 |
|
| | 27 | % Chart subclass support
|
| | 28 | % Invoke title method with same number of outputs to defer output arg
|
| | 29 | % error handling to the method.
|
< 0.001 | 2 | 30 | if isa(ax,'matlab.graphics.chart.Chart')
|
| | 31 | if(nargout == 1)
|
| | 32 | hh = title(ax,args{:});
|
| | 33 | else
|
| | 34 | title(ax,args{:});
|
| | 35 | end
|
| | 36 | return
|
| | 37 | end
|
< 0.001 | 2 | 38 | end
|
| | 39 |
|
< 0.001 | 2 | 40 | string = args{1};
|
< 0.001 | 2 | 41 | if isempty(string), string=''; end
|
< 0.001 | 2 | 42 | pvpairs = args(2:end);
|
| | 43 |
|
| | 44 | % get-set does not support strings as of now
|
< 0.001 | 2 | 45 | pvpairs = matlab.graphics.internal.convertStringToCharArgs(pvpairs);
|
| | 46 |
|
| | 47 | %---Check for bypass option
|
< 0.001 | 2 | 48 | if isappdata(ax,'MWBYPASS_title')
|
| | 49 | h = mwbypass(ax,'MWBYPASS_title',string,pvpairs{:});
|
| | 50 |
|
| | 51 | %---Standard behavior
|
< 0.001 | 2 | 52 | else
|
0.002 | 2 | 53 | matlab.graphics.internal.markFigure(ax);
|
0.016 | 2 | 54 | h = get(ax,'Title');
|
| | 55 |
|
< 0.001 | 2 | 56 | set(h, 'String', string, pvpairs{:});
|
| | 57 |
|
< 0.001 | 2 | 58 | end
|
| | 59 |
|
< 0.001 | 2 | 60 | if nargout > 0
|
| | 61 | hh = h;
|
| | 62 | end
|
Other subfunctions in this file are not included in this listing.