在头文件中声明了一个动态数组
CPtrArray m_OrgData;从文件中读取数据
float temp[6000];//not too small ,size is 6000
for(int i=0;i<m_nTracesPerInline;i++)
{
m_file.Read(temp,m_nSamplesPerTrace*sizeof(float));
this->m_OrgData.Add(temp);
int length=m_iwagc/(m_nSampleInterval/1000);
Agc(temp,length,m_nSamplesPerTrace);}
这样我是想把从文件中读取到的数据保存到数组中,在调用AGC()函数,上面程序能够正常运行可是如果我想把数据取出来时在调用AGC()函数却抱错误
代码如下
float *temp;
for(int i=0;i<m_OrgData.GetSize();i++)
{
temp=(float*)m_OrgData.GetAt(i);
int length=m_iwagc/(m_nSampleInterval/1000);
Agc(temp,length,m_nSamplesPerTrace);
}
CPtrArray m_OrgData;从文件中读取数据
float temp[6000];//not too small ,size is 6000
for(int i=0;i<m_nTracesPerInline;i++)
{
m_file.Read(temp,m_nSamplesPerTrace*sizeof(float));
this->m_OrgData.Add(temp);
int length=m_iwagc/(m_nSampleInterval/1000);
Agc(temp,length,m_nSamplesPerTrace);}
这样我是想把从文件中读取到的数据保存到数组中,在调用AGC()函数,上面程序能够正常运行可是如果我想把数据取出来时在调用AGC()函数却抱错误
代码如下
float *temp;
for(int i=0;i<m_OrgData.GetSize();i++)
{
temp=(float*)m_OrgData.GetAt(i);
int length=m_iwagc/(m_nSampleInterval/1000);
Agc(temp,length,m_nSamplesPerTrace);
}
而用m_OrgData.GetCount()就OK了。
GetSize Gets number of elements in this array.
GetUpperBound Returns the largest valid index.
SetSize Sets the number of elements to be contained in this array. Operations FreeExtra Frees all unused memory above the current upper bound.
IsEmpty Determines of the array is empty.
RemoveAll Removes all the elements from this array. Element Access ElementAt Returns a temporary reference to the element pointer within the array.
GetAt Returns the value at a given index.
GetData Allows access to elements in the array. Can be NULL.
SetAt Sets the value for a given index; array is not allowed to grow. Growing the Array Add Adds an element to the end of the array; grows the array if necessary.
Append Appends another array to the array; grows the array if necessary.
Copy Copies another array to the array; grows the array if necessary.
SetAtGrow Sets the value for a given index; grows the array if necessary. Insertion/Removal InsertAt Inserts an element (or all the elements in another array) at a specified index.
RemoveAt Removes an element at a specific index. Operators operator []