How can I programatically set the page header for printing a figure in MATLAB 7.0 (R14)?

4 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
1. Create a figure by executing the following command:
plot(1:10)
2. The page header of the current figure can be set by executing the following commands:
hs = getappdata(gcf,'PrintHeaderHeaderSpec');
if isempty(hs)
hs = struct('dateformat','none',...
'string','',...
'fontname','Times',...
'fontsize',12,... % in points
'fontweight','normal',...
'fontangle','normal',...
'margin',72); % in points
end
currentPage = 1;
totalPages = 10;
hs.string = ['Header: Page ' num2str(currentPage) ' of ' num2str(totalPages)];
setappdata(gcf,'PrintHeaderHeaderSpec',hs);
3. The header will be visible when the figure is printed or previewed by selecting "File -> Print Preview".

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by