r310: plotfile updates
[ctsim.git] / libctsupport / plotfile.cpp
index 5a160cdbe4bbf31a1f18291b1f887e0962bc8c81..b9e8ac641b5a80a3b5e905600634bf4f41605473 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.cpp,v 1.3 2000/12/20 20:08:48 kevin Exp $
+**  $Id: plotfile.cpp,v 1.4 2000/12/21 03:40:58 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -153,15 +153,17 @@ PlotFile::statistics (int iStartingCol, double& min, double& max, double& mean,
 \r
        int iOffset = iStartingCol * m_iNumRecords;\r
        int iNPoints = (m_iNumColumns - iStartingCol) * m_iNumRecords;\r
-       std::vector<double> vec (iNPoints);\r
+       std::vector<double> vec;\r
+       vec.resize (iNPoints);\r
 \r
+       int iVec = 0;\r
        for (int iCol = iStartingCol; iCol < m_iNumColumns; iCol++) {\r
                int iOffset = iCol * m_iNumRecords;\r
                for (int iRec = 0; iRec < m_iNumRecords; iRec++)\r
-                       vec.push_back( m_vecCurves[ iRec + iOffset ] );\r
+                       vec[iVec++] = m_vecCurves[ iRec + iOffset ];\r
        }\r
 \r
-       vectorNumericStatistics (vec, min, max, mean, mode, median, stddev);\r
+       vectorNumericStatistics (vec, iNPoints, min, max, mean, mode, median, stddev);\r
 \r
        return true;\r
 }\r