From 8a6d750c518ae139222ddfa11351c8a5ab47a62b Mon Sep 17 00:00:00 2001 From: sebastien Date: Thu, 9 Jul 2009 16:35:07 +0000 Subject: [PATCH] Implemented MATLAB part of the block_mfs option to steady. (Still need to fix a bug) git-svn-id: https://www.dynare.org/svn/dynare/trunk@2829 ac1d8469-bf42-47a9-8791-bf33cf982152 --- StaticModel.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/StaticModel.cc b/StaticModel.cc index f36565d4..fd6f4d33 100644 --- a/StaticModel.cc +++ b/StaticModel.cc @@ -517,15 +517,11 @@ StaticModel::writeOutput(ostream &output) const if (!block_mfs) return; - output << "M_.blocks = cell(" << blocks.size() << ", 1);" << endl - << "M_.blocksMFS = cell(" << blocksMFS.size() << ", 1);" << endl; + output << "M_.blocksMFS = cell(" << blocksMFS.size() << ", 1);" << endl; for(int b = 0; b < (int) blocks.size(); b++) { - output << "M_.blocks{" << b+1 << "} = [ "; - transform(blocks[b].begin(), blocks[b].end(), ostream_iterator(output, " "), bind2nd(plus(), 1)); - output << "];" << endl - << "M_.blocksMFS{" << b+1 << "} = [ "; - transform(blocksMFS[b].begin(), blocksMFS[b].end(), ostream_iterator(output, " "), bind2nd(plus(), 1)); + output << "M_.blocksMFS{" << b+1 << "} = [ "; + transform(blocksMFS[b].begin(), blocksMFS[b].end(), ostream_iterator(output, "; "), bind2nd(plus(), 1)); output << "];" << endl; } } @@ -533,7 +529,7 @@ StaticModel::writeOutput(ostream &output) const void StaticModel::writeStaticBlockMFSFile(ostream &output, const string &func_name) const { - output << "function [y, residual, g1] = " << func_name << "(nblock, y, x, params)" << endl + output << "function [residual, g1, y] = " << func_name << "(nblock, y, x, params)" << endl << " switch nblock" << endl; for(int b = 0; b < (int) blocks.size(); b++) @@ -596,4 +592,7 @@ StaticModel::writeStaticBlockMFSFile(ostream &output, const string &func_name) c i++; } } + + output << " end" << endl + << "end" << endl; }