diff --git a/src/@dseries/save.m b/src/@dseries/save.m
index 8f4bb0fe6a628778528d3052f283d4a50e158e32..a7520fd821eebd201f024d0cabafe4e2f8123c29 100644
--- a/src/@dseries/save.m
+++ b/src/@dseries/save.m
@@ -103,16 +103,12 @@ switch format
     TEX__ = o.tex;
     OPS__ = o.ops;
     TAGS__ = o.tags;
-    str = [];
-    for v = 1:vobs(o)
-        str = sprintf('%s %s = o.data(:,%u);', str, o.name{v}, v);
-    end
-    eval(str);
+    DATA__ = o.data;
     currentdirectorycontent = dir();
     if ismember([basename, '.mat'], {currentdirectorycontent.name})
         copyfile([basename, '.mat'], [basename, '.old.mat']);
     end
-    save([basename '.mat'], 'INIT__', 'FREQ__', 'NAMES__', 'TEX__', 'OPS__', 'TAGS__', o.name{:});
+    save([basename '.mat'], 'INIT__', 'FREQ__', 'NAMES__', 'TEX__', 'OPS__', 'TAGS__', 'DATA__');
   case 'csv'
     currentdirectorycontent = dir();
     if ismember([basename, '.csv'],{currentdirectorycontent.name})
diff --git a/src/read/load_mat_file_data.m b/src/read/load_mat_file_data.m
index 23a9b32d5f63784d18ffdce22c576c3caca19430..da7f53227058e5c5c7c8c544fff82cbb780e4a07 100644
--- a/src/read/load_mat_file_data.m
+++ b/src/read/load_mat_file_data.m
@@ -85,21 +85,28 @@ else
     tags = struct();
 end
 
-data = [];
-if isempty(varlist)
-    varlist = fieldnames(datafile);
-end
-
-for i=1:length(varlist)
-    try
-        tmp = datafile.(varlist{i});
-        if isvector(tmp)
-            data = [data,  tmp(:)];
-        else
-            error('load_mat_file:: All the variables must be vectors (%s is not a vector)!', varlist{i})
+if isfield(datafile,'DATA__')
+    data = datafile.DATA__;
+    datafile = rmfield(datafile, 'DATA__');
+else
+    % Previously to dynare 4.6 variables were stored as vectors of
+    % common length in the mat file. This part of the code deals
+    % with mat files generated by these older versions of Dynare.
+    data = [];
+    if isempty(varlist)
+        varlist = fieldnames(datafile);
+    end
+    for i=1:length(varlist)
+        try
+            tmp = datafile.(varlist{i});
+            if isvector(tmp)
+                data = [data,  tmp(:)];
+            else
+                error('load_mat_file:: All the variables must be vectors (%s is not a vector)!', varlist{i})
+            end
+        catch
+            error('load_mat_file:: All the vectors (variables) in %s must have the same number of rows (observations)!', inputname(1))
         end
-    catch
-        error('load_mat_file:: All the vectors (variables) in %s must have the same number of rows (observations)!', inputname(1))
     end
 end