Mercurial Hosting > traffic-intelligence
diff c/utils.cpp @ 145:7bf8084e720f
removed bug with loadMat and added diagnosis code for empty frames
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 29 Aug 2011 19:20:37 -0400 |
parents | b32947b002da |
children | c8a149fccfda |
line wrap: on
line diff
--- a/c/utils.cpp Fri Aug 26 19:38:11 2011 -0400 +++ b/c/utils.cpp Mon Aug 29 19:20:37 2011 -0400 @@ -10,18 +10,19 @@ vector<vector<float> > loadNumbers(const string& filename, const string& separator /* = " " */) { ifstream in(filename.c_str()); - ::openCheck(in, filename, "loadNumbers"); vector<vector<float> > result; - while (!in.eof()) { - string line = ::getlineComment(in); - vector<string> tokens; - ::split(tokens, line, separator); - vector<float> numbers; - BOOST_FOREACH(string s, tokens) - numbers.push_back(::toInt(s)); - if (!numbers.empty()) - result.push_back(numbers); + if (::openCheck(in, filename, "loadNumbers")) { + while (!in.eof()) { + string line = ::getlineComment(in); + vector<string> tokens; + ::split(tokens, line, separator); + vector<float> numbers; + BOOST_FOREACH(string s, tokens) + numbers.push_back(::toInt(s)); + if (!numbers.empty()) + result.push_back(numbers); + } } return result;