ols: fix bug when finding parameter names

time-shift
Houtan Bastani 2017-07-07 17:53:40 +02:00
parent 07fb484987
commit 460c8d264b
1 changed files with 7 additions and 2 deletions

View File

@ -62,9 +62,14 @@ for i = 1:nols
% Find parameters
pnames = cell(1, length(vwlags));
for j = 1:length(vwlags)
regexmatch = regexp(rhs{i}, ['\w*\*?' strrep(strrep(vwlags{j}, '(', '\('), ')', '\)')], 'match');
regexmatch = regexp(rhs{i}, ['(\w*\*?)?' strrep(strrep(vwlags{j}, '(', '\('), ')', '\)') '(\*?\w*)?'], 'match');
regexmatch = strsplit(regexmatch{:}, '*');
pnames{j} = regexmatch{1};
assert(length(regexmatch) == 2);
if strcmp(vwlags{j}, regexmatch{1})
pnames{j} = regexmatch{2};
else
pnames{j} = regexmatch{1};
end
end
X = cell2mat(cellfun(@eval, strcat('ds.', vwlags, '.data'), 'UniformOutput', false));