1function ext = get_file_extension(file) 2 3% returns the extension of a file. 4% 5% INPUTS 6% o file string, name of the file 7% 8% OUTPUTS 9% o ext string, extension. 10% 11% REMARKS 12% If the provided file name has no extension, the routine will return an empty array. 13 14% Copyright (C) 2013-2017 Dynare Team 15% 16% This file is part of Dynare. 17% 18% Dynare is free software: you can redistribute it and/or modify 19% it under the terms of the GNU General Public License as published by 20% the Free Software Foundation, either version 3 of the License, or 21% (at your option) any later version. 22% 23% Dynare is distributed in the hope that it will be useful, 24% but WITHOUT ANY WARRANTY; without even the implied warranty of 25% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26% GNU General Public License for more details. 27% 28% You should have received a copy of the GNU General Public License 29% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 30 31[dir, fname, ext] = fileparts(file); 32 33if ~isempty(ext) 34 % Removes the leading dot. 35 ext = ext(2:end); 36end