1 |
function timestamp(mfile,adjusthrs) |
---|
2 |
%TIMESTAMP Add time stamp to the current plot. |
---|
3 |
% TIMESTAMP(MFILE) writes the string MFILE and the actual date and time |
---|
4 |
% to the lower left corner of the current plot. |
---|
5 |
% Time stamps could be removed using the command: |
---|
6 |
% delete(get(gca,'UserData')) |
---|
7 |
|
---|
8 |
% 9-Nov-95, C. Mertens, IfM Kiel |
---|
9 |
% made comp. with MATLAB 5.2 G.K. Nov 1998 |
---|
10 |
% 8-Aug-06, C. Edwards: changed inputs to allow for time zones, removed pwd |
---|
11 |
|
---|
12 |
if nargin == 0 |
---|
13 |
mfile = ''; |
---|
14 |
elseif(~isstr(mfile)) |
---|
15 |
adjusthrs=mfile; |
---|
16 |
%else |
---|
17 |
% mfile = [pwd,'/',mfile]; |
---|
18 |
end |
---|
19 |
|
---|
20 |
a = gca; |
---|
21 |
h = axes('Units','normalized','Position',[0 0 1 1],'Visible','off'); |
---|
22 |
time = fix(clock); |
---|
23 |
|
---|
24 |
if(nargin>1) |
---|
25 |
time=datevec(datestr(time+[0 0 0 adjusthrs 0 0])); |
---|
26 |
end |
---|
27 |
stime = sprintf('%s %4.4d/%2.2d/%2.2d %2.2d:%2.2d',mfile,time(1:5)); |
---|
28 |
text(0.91,0.02,stime,'FontSize',6,'HorizontalAlignment','right', ... |
---|
29 |
'VerticalAlignment','bottom') |
---|
30 |
%axes(a) |
---|
31 |
set(a,'UserData',h); |
---|
32 |
|
---|