function  th = signature(logo,name,fontsize)

% SIGNATURE  Produces a "signature" with author's name and
%         creation time at the bottom of a figure.
%     SIGNATURE(LOGO,NAME,FONTSIZE)
%         The fontsizes of the texts can be also specified by
%         FONTSIZE argument.
%         All input arguments are optional, but must be input in
%         the given order. If some or all arguments are not
%         specified, the default values are entered.
%         Additional properties can be specified within the program:
%         ISHM - (1 or 0) if hours:minutes to be added to date;
%         FTNAME - fontname.
%    TH = SIGNATURE ... also returns handle(s) of the created
%         text object(s).

% Defaults and setup
namedflt = 'D Menemenlis';           % Name default
logodflt = pwd;                      % "Logo" default
ftszdflt = 5;                        % Font size default

ishm = 1;                            % Is hours/minutes to be added
ftname = 'helvetica';                % Fontname

% Handle input
if nargin<3, fontsize = ftszdflt; end
if nargin<2, name = namedflt; end
if nargin<1, logo = logodflt; end

% Create a time string
time = clock;
cstr = num2str(time(5));
if length(cstr)==1, cstr = ['0' cstr]; end % Add '0' for minutes
d = date;
if ishm, d = [d ', ' num2str(time(4)) ':' cstr]; end
string = [name '  ' d ', ' logo];

% Make an invisible axes
ah = axes('units','normal','pos',[0 0 1 .02],'visible','off');
set(ah,'xlim',[0 1],'ylim',[0 1])
th = text(.6,.5,string,'fontsize',ftszdflt);
