aggregate.m: compatibility fix for MATLAB R2014a

The importdata function returns empty lines on R2014a, while it omits them in
R2020a. Moreover, importdata is not meant to parse arbitrary text file. We thus
replace it by repeated calls to fgetl.
time-shift
Sébastien Villemot 2021-01-29 12:29:39 +01:00
parent 5fc29ace8f
commit 3e98918690
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 11 additions and 1 deletions

View File

@ -63,7 +63,17 @@ eqlist = cell(MAX_NUMBER_OF_ELEMENTS, 4);
tagnum = 1;
eqnum = 0;
for i=1:length(varargin)
model = importdata(sprintf('%s/model.inc', varargin{i}));
% Store all non-empty lines of model.inc in the “model” cell-array
fid = fopen(sprintf('%s/model.inc', varargin{i}));
model = {};
while ~feof(fid)
line = fgetl(fid);
if ~isempty(line)
model{end+1} = line;
end
end
fclose(fid);
eqtag = false;
for j=1:length(model)
if isequationtag(model{j})