Added broadcasting when assigning new data to a dynSeries object.
*Examples* * ts.A(qq(1950,1):qq(1950,4)) = 1 will put ones for variable A in periods 1950Q1 to 1950Q4 * ts{'A','B'}(qq(1950,1):qq(1950,4)) = 1 will put ones for variables A and B in periods 1950Q1 to 1950Q4 * ts{'A','B'}(qq(1950,1):qq(1950,4)) = ones(4,1) will put ones(4,1) for variables A and B and sub-periods 1950Q1-1950Q4 * ts{'A','B'}(qq(1950,1):qq(1950,4)) = ones(1,2) will put ones(1,2) for variables A and B and each period between 1950Q1 and 1950Q4time-shift
parent
84522ce87f
commit
55ea513f74
|
@ -167,11 +167,19 @@ switch length(S)
|
||||||
if isequal(length(tdx),rows(B))
|
if isequal(length(tdx),rows(B))
|
||||||
if isequal(columns(sA.data),columns(B))
|
if isequal(columns(sA.data),columns(B))
|
||||||
sA.data(tdx,:) = B;
|
sA.data(tdx,:) = B;
|
||||||
|
elseif isequal(size(B,2),1)
|
||||||
|
sA.data(tdx,:) = repmat(B,1,columns(sA.data));
|
||||||
else
|
else
|
||||||
error('dynSeries::subsasgn: Dimension error! The number of variables on the left and right hand side must match.')
|
error('dynSeries::subsasgn: Dimension error! The number of variables on the left and right hand side must match.')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
error('dynSeries::subsassgn: Dimension error! The number of periods on the left and right hand side must match.')
|
if isequal(columns(sA.data),columns(B)) && isequal(rows(B),1)
|
||||||
|
sA.data(tdx,:) = repmat(B,length(tdx),1);
|
||||||
|
elseif isequal(rows(B),1)
|
||||||
|
sA.data(tdx,:) = B
|
||||||
|
else
|
||||||
|
error('dynSeries::subsassgn: Dimension error! The number of periods on the left and right hand side must match.')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
error('dynSeries::subsasgn: The object on the right hand side must be a dynSeries object or a numeric array!')
|
error('dynSeries::subsasgn: The object on the right hand side must be a dynSeries object or a numeric array!')
|
||||||
|
|
Loading…
Reference in New Issue