Commit d898f760 authored by Stéphane Adjemian's avatar Stéphane Adjemian

Fixed merge of empty dseries.

parent 40263275
...@@ -32,13 +32,24 @@ function q = merge(o, p, rewritewithnans) % --*-- Unitary tests --*-- ...@@ -32,13 +32,24 @@ function q = merge(o, p, rewritewithnans) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~isdseries(p) if ~isdseries(p) || ~isdseries(o)
error('dseries::merge: Both inputs must be dseries objects!') error('dseries::merge: Both inputs must be dseries objects!')
end end
if isempty(o) && ~isempty(p)
q = p;
return
elseif ~isempty(o) && isempty(p)
q = o;
return
elseif isempty(o) && isempty(p)
q = p;
return
end
if ~isequal(frequency(o), frequency(p)) if ~isequal(frequency(o), frequency(p))
if isempty(inputname(1)) if isempty(inputname(1))
error(['dseries::merge: Cannot merge dseries objects (frequencies are different)!']) error('dseries::merge: Cannot merge dseries objects (frequencies are different)!')
else else
error(['dseries::merge: Cannot merge ' inputname(1) ' and ' inputname(2) ' (frequencies are different)!']) error(['dseries::merge: Cannot merge ' inputname(1) ' and ' inputname(2) ' (frequencies are different)!'])
end end
......
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