From 755b572548d0abe220c4f794a52f216ad52b6838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 10 Apr 2014 11:29:11 +0200 Subject: [PATCH] Simplify MATLAB output of symbol lists. --- preprocessor/SymbolList.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/preprocessor/SymbolList.cc b/preprocessor/SymbolList.cc index af4c19114..dca1410ec 100644 --- a/preprocessor/SymbolList.cc +++ b/preprocessor/SymbolList.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 Dynare Team + * Copyright (C) 2003-2014 Dynare Team * * This file is part of Dynare. * @@ -28,13 +28,15 @@ SymbolList::addSymbol(const string &symbol) void SymbolList::writeOutput(const string &varname, ostream &output) const { - output << varname << "=[];" << endl; + output << varname << " = char("; for (vector::const_iterator it = symbols.begin(); - it != symbols.end(); it++) - if (it == symbols.begin()) - output << varname << " = '" << *it << "';" << endl; - else - output << varname << " = char(" << varname << ", '" << *it << "');" << endl; + it != symbols.end(); ++it) + { + if (it != symbols.begin()) + output << ","; + output << "'" << *it << "'"; + } + output << ");" << endl; } void