Compatibility fix for Octave in x13 routines

On MATLAB, importdata() is better at automatically guessing the delimiter.
Enforce tab delimiter to make it work on Octave.

Closes #39
parent b3d82b5f
......@@ -42,7 +42,7 @@ if ~all(cellfun(@isempty, struct2cell(o.regression)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i});
end
......@@ -57,7 +57,7 @@ if ~all(cellfun(@isempty, struct2cell(o.x11)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i});
end
......@@ -72,7 +72,7 @@ if ~all(cellfun(@isempty, struct2cell(o.forecast)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
initdate = num2str(tmp.data(1,1)); % wrong in series
t = o.y.dates;
name = strsplit(tmp.textdata{1},'\t');
......@@ -97,7 +97,7 @@ if ~all(cellfun(@isempty, struct2cell(o.transform)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i});
end
......@@ -112,7 +112,7 @@ if ~all(cellfun(@isempty, struct2cell(o.outlier)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
if lower(savedoutput{i}) == 'fts'
header = strjoin(tmp.textdata(1));
......@@ -146,7 +146,7 @@ if ~all(cellfun(@isempty, struct2cell(o.slidingspans)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
header = strjoin(tmp.textdata(1));
header = strsplit(header, {'\t'});
......@@ -167,7 +167,7 @@ if ~all(cellfun(@isempty, struct2cell(o.identify)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
header = strjoin(tmp.textdata(3,1));
header = strsplit(header, {'\t'});
......@@ -194,7 +194,7 @@ if ~all(cellfun(@isempty, struct2cell(o.check)))
if lower(savedoutput{i}) == 'ac2'
o.results.(savedoutput{i}) = fileread(sprintf('%s.ac2', basename));
else
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
header = strjoin(tmp.textdata(1,1));
header = strsplit(header, {'\t'});
......@@ -217,7 +217,7 @@ if ~all(cellfun(@isempty, struct2cell(o.force)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i});
end
......@@ -232,7 +232,7 @@ if ~all(cellfun(@isempty, struct2cell(o.spectrum)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
header = strjoin(tmp.textdata(1,1));
header = strsplit(header, {'\t'});
......@@ -252,7 +252,7 @@ if ~all(cellfun(@isempty, struct2cell(o.seats)))
savedoutput = savedoutput(~cellfun('isempty', savedoutput));
for i=1:length(savedoutput)
if exist(sprintf('%s.%s', basename, lower(savedoutput{i})))
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i});
end
......@@ -271,7 +271,7 @@ if ~all(cellfun(@isempty, struct2cell(o.x11regression)))
if lower(savedoutput{i}) == 'xrc'
o.results.out = fileread(sprintf('%s.xrc', basename));
else
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i});
end
......@@ -306,7 +306,7 @@ if ~all(cellfun(@isempty, struct2cell(o.estimate)))
end
o.results.(savedoutput{i}) = fileread(sprintf('%s.estx', basename));
else
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})));
tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i})), '\t');
data = tmp.data;
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment