diff --git a/preprocessor/DataTree.cc b/preprocessor/DataTree.cc index cc8da091d..f151fa3aa 100644 --- a/preprocessor/DataTree.cc +++ b/preprocessor/DataTree.cc @@ -659,6 +659,7 @@ DataTree::writePowerDeriv(ostream &output, bool use_dll) const << " dxp = dxp*p;" << endl << " p = p-1;" << endl << " end" << endl - << " end" << endl; + << " end" << endl + << "end" << endl; } diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index ee0673ec6..ec81d2293 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -1530,6 +1530,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const mDynamicModelFile << "global oo_;" << endl << endl; writeDynamicModel(mDynamicModelFile, false); + mDynamicModelFile << "end" << endl; // Close *_dynamic function writePowerDeriv(mDynamicModelFile, false); mDynamicModelFile.close(); } @@ -2213,7 +2214,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const << " g2 = sparse(v2(:,1),v2(:,2),v2(:,3)," << nrows << "," << hessianColsNbr << ");" << endl; else // Either hessian is all zero, or we didn't compute it DynamicOutput << " g2 = sparse([],[],[]," << nrows << "," << hessianColsNbr << ");" << endl; - DynamicOutput << "end;" << endl; + DynamicOutput << "end" << endl; // Initialize g3 matrix DynamicOutput << "if nargout >= 4," << endl @@ -2229,7 +2230,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const else // Either 3rd derivatives is all zero, or we didn't compute it DynamicOutput << " g3 = sparse([],[],[]," << nrows << "," << ncols << ");" << endl; - DynamicOutput << "end;" << endl; + DynamicOutput << "end" << endl; } else { diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc index f072ff2b2..79624b3f6 100644 --- a/preprocessor/StaticModel.cc +++ b/preprocessor/StaticModel.cc @@ -1244,7 +1244,8 @@ StaticModel::writeStaticMFile(const string &func_name) const else // Either hessian is all zero, or we didn't compute it output << " g2 = sparse([],[],[]," << equations.size() << "," << g2ncols << ");" << endl; - output << "end;" << endl; // Close the if nargout >= 3 statement + output << "end" << endl; // Close the if nargout >= 3 statement + output << "end" << endl; // Close the *_static function writePowerDeriv(output, false); output.close(); }