CSV export + DFT math operation

This commit is contained in:
Jan Käberich 2020-12-11 20:28:40 +01:00
parent 79a990af47
commit 6e55eb02dd
27 changed files with 935 additions and 52 deletions

View file

@ -627,6 +627,10 @@ int Trace::index(double x)
auto lower = lower_bound(lastMath->rData().begin(), lastMath->rData().end(), x, [](const Data &lhs, const double x) -> bool {
return lhs.x < x;
});
if(lower == lastMath->rData().end()) {
// actually beyond the last sample, return the index of the last anyway to avoid access past data
return lastMath->rData().size() - 1;
}
return lower - lastMath->rData().begin();
}