diff --git a/ComputingTasks.cc b/ComputingTasks.cc index c51a29ed..7a8fe14d 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -221,8 +221,19 @@ VarModelStatement::createVarModelMFunction(ostream &output, const map horizons = var_expectation_functions_to_write.find(name)->second; for (set::const_iterator it = horizons.begin(); it != horizons.end(); it++) - ss << *it << " "; - output << "writeVarExpectationFunction('" << name << "', [" << ss.rdbuf() << "]);" << endl; + { + if (it != horizons.begin()) + ss << " "; + ss << *it; + } + + output << "writeVarExpectationFunction('" << name << "', "; + if (horizons.size() > 1) + output << "["; + output << ss.rdbuf(); + if (horizons.size() > 1) + output << "]"; + output << ");" << endl; } StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg,