I am reading the data from text file which is basically has rows and columns of double data types. Part of the code is as shown below:
m_data = vector<vector<double> >(columns, vector<double>(lineCount - 3));
for (int x = 0; x < lineCount - 3; x++)
{
for (int y = 0; y < columns; y++)
{
m_data[y][x] = total_Data[it]; //total_Data is the complete data set read from a file
it++; //which contain all data sets from a simulation and they are
//separated into vectors here in this code
}
}
size_t len = m_data[1].size(); //m_data[1] vector represents the signal data set
double signaldata[len];
copy(m_data[1].begin,m_data[1].end,signaldata);
So the problem is when I copy the data from vector to array it requires the constant length of the array for initialization. But size() gives the length of the vector which is not a constant. And sizeof(vector) returns the size of the object itself which is 16 bytes. So how I can overcome this problem of getting a constant size from vector for array initialization
Aucun commentaire:
Enregistrer un commentaire