When a function definition is not followed by any comment, the copyright plate is appended to the end of the file. If however the file does not end with a blank line, the last line is copied under the copyright plate.
The behavior can be reproduced by e.g.
m-file:
function reproducing()
disp('Reproducing bug');
----NO BLANK LINE HERE----
After running
mat2doc [PATH] mat
The resulting m-file is:
function reproducing()
disp('Reproducing bug');
%
% Url: http://ltfat.sourceforge.net/doc/comp/demo_blockproc_header.php
% Copyright (C) 2005-2014 Peter L. Soendergaard soender@users.sourceforge.net.
% This file is part of LTFAT version 1.4.5
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see http://www.gnu.org/licenses/.
disp('Reproducing bug'); <---- HERE IS THE PROBLEM
This is probably a consequence of #18.