From b113785cab9266b551d4fa35c1392e50708eb4ee Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Wed, 19 Feb 2014 09:51:26 +0100
Subject: [PATCH] reporting: table.write: get length only once

---
 matlab/reports/@report_table/write.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/matlab/reports/@report_table/write.m b/matlab/reports/@report_table/write.m
index 0f04f42aa8..b5292369d6 100644
--- a/matlab/reports/@report_table/write.m
+++ b/matlab/reports/@report_table/write.m
@@ -30,7 +30,8 @@ function o = write(o, fid, pg, sec, row, col)
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
 assert(fid ~= -1);
-if length(o.series) == 0
+ne = length(o.series);
+if ne == 0
     warning('@report_table.write: no series to plot, returning');
     return;
 end
@@ -150,7 +151,6 @@ fprintf(fid, '\\hline%%\n');
 fprintf(fid, '%%\n');
 
 % Write Report_Table Data
-ne = length(o.series);
 for i=1:ne
     o.series{i}.writeSeriesForTable(fid, o.range, o.precision);
     if o.showHlines
-- 
GitLab