PAC NLS estimation: Octave compatibility fix
In regular expressions, the end-of-word operator (\>) does not behave the same under Octave and under MATLAB. See: https://savannah.gnu.org/bugs/index.php?59992 In this case, we can simply drop the \> operator, since there is no risk of matching a partial variable name (since there is already “(-1)” at the end of the pattern). By the way, remove a useless parenthesis grouping in the regexp.time-shift
parent
7bbe67748b
commit
8e9085eea4
|
@ -104,9 +104,9 @@ for i=1:length(objNames)
|
|||
end
|
||||
j = regexp(rhs, ['\<', objNames{i}, '\>']);
|
||||
if islaggedvariables
|
||||
jlag = regexp(rhs, ['\<(', objNames{i}, '\(-1\))\>']);
|
||||
jlag = regexp(rhs, ['\<', objNames{i}, '\(-1\)']);
|
||||
if ~isempty(jlag)
|
||||
rhs = regexprep(rhs, ['\<(' objNames{i} '\(-1\))\>'], sprintf('data(1:end-1,%u)', k));
|
||||
rhs = regexprep(rhs, ['\<' objNames{i} '\(-1\)'], sprintf('data(1:end-1,%u)', k));
|
||||
end
|
||||
if ~isempty(setdiff(j, jlag))
|
||||
rhs = regexprep(rhs, ['\<' objNames{i} '\>'], sprintf('data(2:end,%u)', k));
|
||||
|
|
Loading…
Reference in New Issue