toptitle.m

来自「一种新的时频分析方法的matlab源程序。」· M 代码 · 共 40 行

M
40
字号
function h=toptitle(string)

% The function TOPTITLE places a title over a set of subplots.
% Best results are obtained when all subplots are
% created and then TOPTITLE is executed.
%
% Calling sequence-
% h=toptitle(string)
%
% Input-
%	string	- string representing the text
% Output-
%   h       - handler
%
% Example-
%	h=toptitle('title string')

% Patrick Marchand (prmarchand@aol.com)

titlepos = [.5 1]; % normalized units.

ax = gca;
set(ax,'units','normalized');
axpos = get(ax,'position');

offset = (titlepos - axpos(1:2))./axpos(3:4);

text(offset(1),offset(2),string,'units','normalized',...
     'horizontalalignment','center','verticalalignment','middle');

% Make the figure big enough so that when printed the
% toptitle is not cut off nor overlaps a subplot title.
h = findobj(gcf,'type','axes');
set(h,'units','points');
set(gcf,'units','points')
figpos = get(gcf,'position');
set(gcf,'position',figpos + [0 0 0 15])
set(gcf,'units','pixels');
set(h,'units','normalized');

⌨️ 快捷键说明

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