[chronojump] safer fixInertialSignalIfNotFullyExtended
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] safer fixInertialSignalIfNotFullyExtended
- Date: Sat, 6 Aug 2016 00:40:01 +0000 (UTC)
commit 6b063a070fa6f6ea103c79c346bde3b9579f0e90
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Aug 6 02:29:25 2016 +0200
safer fixInertialSignalIfNotFullyExtended
encoder/util.R | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/encoder/util.R b/encoder/util.R
index 22c991f..d59d4b1 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -1129,17 +1129,26 @@ fixInertialSignalIfNotFullyExtended <- function(signal, saveFile, specialDataFil
maximums <- maximums.temp
minimums <- minimums.temp
+ if(length(maximums) < 1 | length(minimums) < 1)
+ return(signal)
+
+
#remove the first value of the maximums OR minimums (just the first one of both)
if(maximums[1] < minimums[1])
maximums <- maximums[-1]
else
minimums <- minimums[-1]
+
+ if(length(maximums) < 1 | length(minimums) < 1)
+ return(signal)
+
#remove the last value of the maximums OR minimums (just the last one of both)
if(maximums[length(maximums)] > minimums[length(minimums)])
maximums <- maximums[-length(maximums)]
else
minimums <- minimums[-length(minimums)]
+
}
#return if no data
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]