From 3e98918690c6523d167935bc48b5ba2cebd37f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 29 Jan 2021 12:29:39 +0100 Subject: [PATCH] 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. --- matlab/aggregate.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/matlab/aggregate.m b/matlab/aggregate.m index e85455506..e0d20b4cc 100644 --- a/matlab/aggregate.m +++ b/matlab/aggregate.m @@ -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})