Simplify MATLAB output of symbol lists.

issue#70
Sébastien Villemot 2014-04-10 11:29:11 +02:00
parent bd89254791
commit 27c2396a81
1 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2003-2010 Dynare Team * Copyright (C) 2003-2014 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
@ -28,13 +28,15 @@ SymbolList::addSymbol(const string &symbol)
void void
SymbolList::writeOutput(const string &varname, ostream &output) const SymbolList::writeOutput(const string &varname, ostream &output) const
{ {
output << varname << "=[];" << endl; output << varname << " = char(";
for (vector<string>::const_iterator it = symbols.begin(); for (vector<string>::const_iterator it = symbols.begin();
it != symbols.end(); it++) it != symbols.end(); ++it)
if (it == symbols.begin()) {
output << varname << " = '" << *it << "';" << endl; if (it != symbols.begin())
else output << ",";
output << varname << " = char(" << varname << ", '" << *it << "');" << endl; output << "'" << *it << "'";
}
output << ");" << endl;
} }
void void