The title of a figure
270 次查看(过去 30 天)
显示 更早的评论
Hye, How could I give a title to a figure that depend on the input of the function that create the figure.
0 个评论
采纳的回答
Jan
2011-7-19
At creation:
figure('NumberTitle', 'off', 'Name', 'This is the figure title');
After creation:
FigH = figure;
...
set(FigH, 'NumberTitle', 'off', ...
'Name', sprintf('Date: %s', datestr(now, 0)));
[EDITED]: 'NumerTitle' -> 'NumberTitle'
5 个评论
Jan
2011-7-19
*Ranting*?! I'm *crying*. Currently I have to wait for 2 seconds after each keystroke. Irch #+*7&
@Liber-T: There might be a misunderstanding: What exactly do you mean by "title"? The title on top of the plots inside the figure, or the title of the Window?
更多回答(1 个)
Daniel Shub
2011-7-19
Title can take any string. You can use [] and num2str to make a meaningful string that depends on the input to your function
x = 1:3
title(['This figure used x = ', num2str(x)])
In some cases you might want to use sprintf instead of num2str to get a little better control of the formatting.
2 个评论
Daniel Shub
2011-7-19
Where do you want the title to show up? I think
figure
plot
plot
title
figure
plot
title
will work
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Title 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!