function h = gpf()
%GPF    Get handle of the figure that is next to the top of the stack.
%   H = GPF returns the next-to-the-top figure (penultimate
%   figure) in the root's figure stack.
%
%   If there is only one figure open, GPF will return its
%   handle. If there are currently no figures open, GPF will 
%   will open a figure and return its handle.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 5.5 $  $Date: 2000/06/01 03:46:52 $

hList = get(0,'Children');

if length(hList) > 1,
    h = hList(2);
else
    h=gcf;
end
