Hi,

I am having a problem with the following function:

```
void calcEnergy( vector< vector<double> > &Energy, vector< vector<double> > &Data, const double Constant )
{
double Time = 6; // store the change in time
double energy ; // Temp variable to store energy
double v1,v2;
for ( size_t i = 1; i < Data.size(); i++ ) // ignore the first row!
{
vector< double > Rows;
cout << Data[ i ][ 0 ] << "\t" << Data[ i ][ 1 ] << endl;
Rows.push_back( Data[ i ][ 0 ] ); // push on year
Rows.push_back( Data[ i ][ 1 ] ); // push on month
Rows.push_back( Time ); // push on the time difference
v1 = Data[ i ][ 9 ];
v2 = Data[ i+1 ][ 9 ];
cout << v1 << "\t" << v2 << endl;
energy = Constant * 6.0 * ( pow( v1, 3 ) + pow( v2, 3 ) ); // calc the energy
cout << "Energy is " << energy << endl;
Rows.push_back( energy ); // push on the energy
cout << "Row vect is \t";
for (size_t j = 0; j < Rows.size(); j++ )
cout << setw( 7 ) << Rows[ j ];
cout << endl;
Energy.push_back( Rows ); // push on energy
}
}
```

The Row vector output should be giving me something like...

2009 3 6 5252

but the operation squashes the time and energy together (why is it not pushing correctly?)...

2009 3 65252

and then bombs out when trying to push Rows onto Energy, probably due to a subscript error.

Please help!

Thanks :)