test for leads in equation
parent
f78e166aa7
commit
b7a8ad6b7e
|
@ -39,13 +39,17 @@ end
|
|||
|
||||
jsonmodel = loadjson(jsonfile);
|
||||
jsonmodel = jsonmodel.model;
|
||||
[lhs, rhs, ~] = getEquationsByTags(jsonmodel, varargin{:});
|
||||
[lhs, rhs, lineno] = getEquationsByTags(jsonmodel, varargin{:});
|
||||
|
||||
Y = ds{lhs}.data;
|
||||
|
||||
rhs_ = strsplit(rhs, {'+','-','*','/','^','log(','exp(','(',')'});
|
||||
rhs_(cellfun(@(x) all(isstrprop(x, 'digit')), rhs_)) = [];
|
||||
vnames = setdiff(rhs_, cellstr(M_.param_names));
|
||||
regexprnoleads = cell2mat(strcat('(', vnames, {'\(\d+\))|'}));
|
||||
if ~isempty(regexp(rhs, regexprnoleads(1:end-1), 'match'))
|
||||
error(['olseqs: you cannot have leads in equation on line ' lineno ': ' lhs ' = ' rhs]);
|
||||
end
|
||||
regexpr = cell2mat(strcat('(', vnames, {'\(-\d+\))|'}));
|
||||
vwlags = regexp(rhs, regexpr(1:end-1), 'match');
|
||||
X = cell2mat(cellfun(@eval, strcat('ds.', vwlags, '.data'), 'UniformOutput', false));
|
||||
|
|
|
@ -54,6 +54,11 @@ pnames = cellstr(M_.param_names);
|
|||
vnames = setdiff(rhs_, pnames);
|
||||
pnames = setdiff(rhs_, vnames);
|
||||
|
||||
regexprnoleads = cell2mat(strcat('(', vnames, {'\(\d+\))|'}));
|
||||
if ~isempty(regexp(rhs, regexprnoleads(1:end-1), 'match'))
|
||||
error(['plot_contributions: you cannot have leads in equation on line ' lineno ': ' lhs ' = ' rhs]);
|
||||
end
|
||||
|
||||
% Get values for the parameters
|
||||
idp = strmatch(pnames{1}, M_.param_names, 'exact');
|
||||
str = sprintf('%s = M_.params(%d);', pnames{1}, idp);
|
||||
|
|
Loading…
Reference in New Issue