Commit a90ca581 authored by Simone Liuzzo's avatar Simone Liuzzo

fixed error in DAngle_Angle

parent 84e9c137
......@@ -193,7 +193,7 @@ if find([ErrorTable.b_n_systematic ErrorTable.b_n_random])
lb = find(b_n_syst,1,'last'); if isempty(lb), lb = 0; end
la = find(a_n_syst,1,'last'); if isempty(la), la = 0; end
lastnonzero = max(la,lb);
if ~isempty(lastnonzero) % if there are multipole errors
if ~isempty(lastnonzero) && lastnonzero~=0 % if there are multipole errors
% set maxorder
maxord = lastnonzero -1;
rerr=atsetfieldvalues(rerr,magind(im),'MaxOrder',maxord); % get max order
......@@ -203,8 +203,13 @@ if find([ErrorTable.b_n_systematic ErrorTable.b_n_random])
pb0 = atgetfieldvalues(rerr,magind(im),'PolynomB',{1,1:maxord+1});
pa0 = atgetfieldvalues(rerr,magind(im),'PolynomA',{1,1:maxord+1});
% add errors
newb = pb0{1} + b_n_syst(1:(maxord+1));
newa = pa0{1} + a_n_syst(1:(maxord+1));
try
newb = pb0{1} + b_n_syst(1:(maxord+1));
newa = pa0{1} + a_n_syst(1:(maxord+1));
catch % case of a single element in pb0 pa0
newb = pb0(1) + b_n_syst(1:(maxord+1));
newa = pa0(1) + a_n_syst(1:(maxord+1));
end
% set new PolynomB with errors
rerr = atsetfieldvalues(rerr,magind(im),'PolynomB',{1,1:maxord+1},newb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment