dyn_ols: small speed improvement

time-shift
Houtan Bastani 2017-11-02 11:28:15 +01:00
parent b7509376e6
commit adbad752b7
1 changed files with 2 additions and 2 deletions

View File

@ -204,16 +204,16 @@ function retval = getStrMoveRight(str)
mathops = '[\+\*\^\-\/]';
mathidxs = regexp(str, mathops);
openidxs = strfind(str, '(');
openidxs = [(1:length(openidxs))' openidxs'];
if isempty(openidxs) ...
|| (~isempty(mathidxs) ...
&& min(mathidxs) < min(openidxs(:, 2)))
&& min(mathidxs) < min(openidxs))
if isempty(mathidxs)
retval = str;
else
retval = str(1:min(regexp(str, mathops))-1);
end
else
openidxs = [(1:length(openidxs))' openidxs'];
closedidxs = strfind(str, ')');
closedidxs = [(1:length(closedidxs))' closedidxs'];
assert(length(openidxs) == length(closedidxs));