X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;h=8a3b6313072a158f611e1a69a84d0a9713add18c;hb=bd27c2b0612942815b7417c79f7ee41f669a2a34;hp=2900c7ec4fc8e0df952163554f6fefb7e622cd64;hpb=a8e2df1b96a57f5f29576b08361b86a96a8eff4f;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index 2900c7e..8a3b631 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -3272,6 +3272,26 @@ vector MothurOut::getAverages(vector< vector >& dists) { exit(1); } } +/**************************************************************************************************/ +double MothurOut::getAverage(vector dists) { + try{ + double average = 0; + + for (int i = 0; i < dists.size(); i++) { + average += dists[i]; + } + + //finds average. + average /= (double) dists.size(); + + return average; + } + catch(exception& e) { + errorOut(e, "MothurOut", "getAverage"); + exit(1); + } +} + /**************************************************************************************************/ vector MothurOut::getStandardDeviation(vector< vector >& dists) { try{