function tmp_name = tempname
%TEMPNAME Get temporary file.
%   TEMPNAME returns a unique name suitable for use as a temporary file.
%
%   See also TEMPDIR.

%   Marc Ullman  2-8-93
%   Copyright 1984-2000 The MathWorks, Inc.
%   $Revision: 5.9 $  $Date: 2000/06/26 16:03:29 $

t0 = clock;

while(1)
    % loop in place until the time changes, so we can get a unique
    % filename (won't take very long)
    t = clock;
    if (fix(t0(6)*100) ~= fix(t(6)*100))
        break;
    end
end

tmp_name = fullfile(tempdir,sprintf('tp%02.0f%04.0f', t(5), fix(t(6)*100)));

