文本的数据存储格式为m行n列,数据之间的间隔为空格 txt文本最后一行为空
vector<vector<double>> GLAS::Readmntxt(char *inputpath)
{
vector<vector<double>> result;
ifstream infile(inputpath, ios::in);
while (!infile.eof())
{
string str;
double temp;
getline(infile, str);
stringstream ss(str);
vector<double> one_arr;
if (str.size() > 0)//防止最后一行为空
{
while (ss >> temp)
{
one_arr.push_back(temp);
}
result.push_back(one_arr);
}
}
return result;
}