
% FORMAT FO = prepend(FI, prefix)
%  (or)  FO = prepend(FI, prefix, newpath)
% Helper function, that takes in a filename and a prefix, and returns
% a new filename, which is a prefixed version of the input filename.
% The filename can include the full path; the prefix will be added only
% before the 'pure' filename, ie it won't be prepended to the directory.
% If the path also needs to be changed, then the new path is provided as 
% an optional parameter.
% FI       - Input filename[may include path also]
% prefix   - prefix to be added
% newpath  - new path for the file[optional]
% FO       - Output filename
%________________________________________________________________________
% Pavithra Srinivasan, 12 Sep 2002
%

function FO = prepend(FI, prefix, varargin)
    [pathstr, name, ext, ver] = fileparts(deblank(FI));
    if nargin >2
        pathstr = varargin{1};
    end
    FO = fullfile(pathstr,[prefix name ext ver]);   
return;