diff --git a/src/@dseries/dseries.m b/src/@dseries/dseries.m
index f07c7e0047d86249d4832186015777cc25725ac6..698da8ef82fbee8308b2cdc3926357dc52785390 100644
--- a/src/@dseries/dseries.m
+++ b/src/@dseries/dseries.m
@@ -98,6 +98,8 @@ methods
                 o.dates = dates(1,1):dates(1,1)+(nobs(o)-1);
                 o.ops = cell(length(o.name), 1);
                 o.tags = struct();
+            elseif isstruct(varargin{1})
+                o = struct2dseries(varargin{1});
             end
           case  {2,3,4}
             if isequal(nargin,2) && ischar(varargin{1}) && isdates(varargin{2})
diff --git a/src/@dseries/length.m b/src/@dseries/length.m
new file mode 100644
index 0000000000000000000000000000000000000000..335aebce5b085ed92661c12f82a0bb47164cc2ae
--- /dev/null
+++ b/src/@dseries/length.m
@@ -0,0 +1,36 @@
+function length(o) % --*-- Unitary tests --*--
+
+% Overloads size function.
+
+% Copyright (C) 2017 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+error(['dseries::length: we do not support the length operator on ' ...
+       'dseries. Please use ''nobs'' or ''vobs''']);
+
+%@test:1
+%$ % Define a dates object
+%$ ts = dseries(randn(10,1));
+%$ try
+%$     p = length(ts)
+%$     t(1) = false;
+%$ catch
+%$     t(1) = true;
+%$ end
+%$
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/src/@dseries/resetops.m b/src/@dseries/resetops.m
new file mode 100644
index 0000000000000000000000000000000000000000..07e6dbc500435d1af4f6f1c1666fee2626924809
--- /dev/null
+++ b/src/@dseries/resetops.m
@@ -0,0 +1,22 @@
+function o = resetopts(o, ops)
+
+% Redefine ops member.
+
+% Copyright (C) 2017 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+o.ops = ops;
\ No newline at end of file
diff --git a/src/@dseries/resettags.m b/src/@dseries/resettags.m
new file mode 100644
index 0000000000000000000000000000000000000000..817bae174183c73d7f3ea9780316b2194fa7f526
--- /dev/null
+++ b/src/@dseries/resettags.m
@@ -0,0 +1,22 @@
+function o = resettags(o, tags)
+
+% Redefine tags member.
+
+% Copyright (C) 2017 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+o.tags = tags;
\ No newline at end of file
diff --git a/src/@dseries/size.m b/src/@dseries/size.m
index 23dbcd6648707623a90af04e87d1c026dd604c7d..23abd7a354f679e12129d7e807e77370b5cfde24 100644
--- a/src/@dseries/size.m
+++ b/src/@dseries/size.m
@@ -1,4 +1,4 @@
-function varargout = size(o, varargin)
+function varargout = size(o, varargin) % --*-- Unitary tests --*--
 
 % Overloads size function.
 
diff --git a/src/@dseries/subsref.m b/src/@dseries/subsref.m
index 08c496f1dd4eb97687a1bd380876eff1cb3f2f18..fbdd004d6d75211ae12b01cdc9cbe890edff2e25 100644
--- a/src/@dseries/subsref.m
+++ b/src/@dseries/subsref.m
@@ -85,6 +85,9 @@ switch S(1).type
       case 'freq'
         % Returns an integer characterizing the data frequency (1, 4, 12 or 52)
         B = A.dates.freq;
+      case 'length'
+        error(['dseries::subsref: we do not support the length operator on ' ...
+               'dseries. Please use ''nobs'' or ''vobs''']);
       case 'save'                                                        
         % Save dseries object on disk (default is a mat file).
         B = NaN;
@@ -108,6 +111,8 @@ switch S(1).type
         else
             error('dseries::subsref: Call to save method must come in last position!')
         end
+      case 'struct'
+        B = dseries2struct(A);
       case {'baxter_king_filter', 'baxter_king_filter_', ...
             'cumsum','cumsum_', ...
             'insert', ...
@@ -140,7 +145,8 @@ switch S(1).type
             'firstdate', ...
             'firstobservedperiod', ...
             'lastobservedperiod', ...
-            'lineartrend'}
+            'lineartrend', ...
+            'resetops', 'resettags'}
         if length(S)>1 && isequal(S(2).type,'()')
             if isempty(S(2).subs)
                 B = feval(S(1).subs,A);
diff --git a/src/initialize_dseries_toolbox.m b/src/initialize_dseries_toolbox.m
index fe4bb72ec847cc9a5585a0facc3ef623c7d5dd5b..00e6b5bb2686ba5cad41ec3d219045d7531019d0 100644
--- a/src/initialize_dseries_toolbox.m
+++ b/src/initialize_dseries_toolbox.m
@@ -40,7 +40,8 @@ p = {'/read'; ...
      '/utilities/from'; ...
      '/utilities/print'; ...
      '/utilities/variables'; ...
-     '/utilities/cumulate'};
+     '/utilities/cumulate'; ...
+     '/utilities/struct'};
 
 % Add missing routines if dynare is not in the path
 if ~exist('demean','file')
diff --git a/src/@dseries/struct.m b/src/utilities/struct/dseries2struct.m
similarity index 96%
rename from src/@dseries/struct.m
rename to src/utilities/struct/dseries2struct.m
index dfe0cf58776784fa14982d441c04c0a0382ef6a7..7394cdf3e2774c2306fc59d2dc00be3303fbb759 100644
--- a/src/@dseries/struct.m
+++ b/src/utilities/struct/dseries2struct.m
@@ -1,4 +1,4 @@
-function p = struct(o)
+function p = dseries2struct(o)
 
 % Converts dseries object to structure.
 
diff --git a/src/utilities/struct/struct2dseries.m b/src/utilities/struct/struct2dseries.m
new file mode 100644
index 0000000000000000000000000000000000000000..56aa2689edc933c547b0e6998eb25115f3dd59be
--- /dev/null
+++ b/src/utilities/struct/struct2dseries.m
@@ -0,0 +1,35 @@
+function o = struct2dseries(s)
+
+% Converts structure to dseries object.
+
+% Copyright (C) 2017 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+missingfields = setdiff({'data', 'dates', 'name', 'tex', 'ops', 'tags'}, fieldnames(s)); 
+    
+if isempty(missingfields)
+    if s.dates.freq==1
+        time = s.dates.time(1);
+    else
+        time = s.dates.time(1,:);
+    end
+    o = dseries(s.data, dates(s.dates.freq, time), s.name, s.tex);
+    o.resetops(s.ops);
+    o.resettags(s.tags);
+else
+    error('Missing field ins structure: %s\n', missingfields)
+end
\ No newline at end of file