From f7cd6dbf0af764a3601344a77f60f15cc1713b3f Mon Sep 17 00:00:00 2001
From: Willi Mutschler <willi@mutschler.eu>
Date: Thu, 4 Feb 2021 10:48:59 +0100
Subject: [PATCH] :bug: save oo_.time also in _results.mat

---
 src/ModFile.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ModFile.cc b/src/ModFile.cc
index 123a1765..65e8f69c 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -1075,6 +1075,11 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
             static_model.writeAuxVarInitval(mOutputFile, ExprNodeOutputType::matlabOutsideModel);
         }
 
+      if (!notime)
+          mOutputFile << endl << endl
+                      << "oo_.time = toc(tic0);" << endl
+                      << "disp(['Total computing time : ' dynsec2hms(oo_.time) ]);" << endl;
+
       mOutputFile << "save('" << basename << "_results.mat', 'oo_', 'M_', 'options_');" << endl
                   << "if exist('estim_params_', 'var') == 1" << endl
                   << "  save('" << basename << "_results.mat', 'estim_params_', '-append');" << endl << "end" << endl
@@ -1091,11 +1096,6 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
 
       config_file.writeEndParallel(mOutputFile);
 
-      if (!notime)
-          mOutputFile << endl << endl
-                      << "oo_.time = toc(tic0);" << endl
-                      << "disp(['Total computing time : ' dynsec2hms(oo_.time) ]);" << endl;
-
       if (!no_warn)
         {
           if (warnings.countWarnings() > 0)
-- 
GitLab