CSV datafiles: document it, autodetect extension

time-shift
Sébastien Villemot 2013-03-28 12:49:39 +01:00
parent 8311caf304
commit f92965b28c
2 changed files with 5 additions and 3 deletions

View File

@ -3961,7 +3961,7 @@ graphs of smoothed shocks, smoothed observation errors, smoothed and historical
@item datafile = @var{FILENAME}
@anchor{datafile}
The datafile: a @file{.m} file, a @file{.mat} file or, a
The datafile: a @file{.m} file, a @file{.mat} file, a @file{.csv} file, or a
@file{.xls}/@file{.xlsx} file (the latter format is supported under Octave
if the @uref{http://octave.sourceforge.net/io/,io} and
@uref{http://octave.sourceforge.net/java/,java} packages from

View File

@ -17,7 +17,7 @@ function dyn_data_01=read_variables(file_name_01,var_names_01,dyn_data_01,xls_sh
% all local variables have complicated names in order to avoid name
% conflicts with possible user variable names
% Copyright (C) 2005-2012 Dynare Team
% Copyright (C) 2005-2013 Dynare Team
%
% This file is part of Dynare.
%
@ -54,8 +54,10 @@ if isempty(extension)
extension = '.xls';
elseif exist([basename '.xlsx'],'file')
extension = '.xlsx';
elseif exist([basename '.csv'],'file')
extension = '.csv';
else
error(['Can''t find datafile: ' basename '.{m,mat,xls,xlsx}']);
error(['Can''t find datafile: ' basename '.{m,mat,xls,xlsx,csv}']);
end
end