[chronojump] Fixed quitIfNoData in NA situations



commit 166d76862512219709d07cb27db39e5eeed30ad9
Author: Xavier Padullés <x padulles gmail com>
Date:   Fri Mar 4 13:19:54 2016 +0100

    Fixed quitIfNoData in NA situations

 encoder/graph.R |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 4b6e738..a2e1276 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2041,8 +2041,12 @@ createPchVector <- function(ecconVector) {
 #-------------- end of EncoderConfiguration conversions -------------------------
 
 quitIfNoData <- function(n, curves, outputData1) {
+        
+        debugParameters(listN(n, curves, outputData1), "quitIfNoData")
+        
        #if not found curves with this data, plot a "sorry" message and exit
-       if(n == 1 & curves[1,1] == 0 & curves[1,2] <= 0) { #bad curves[1,2] on inertial returns -1
+       if( n == 1 && 
+          (is.na(curves[1,1]) || curves[1,1] == 0 || is.na(curves[1,2]) || curves[1,2] <= 0) ) { #bad 
curves[1,2] on inertial returns -1
                plot(0,0,type="n",axes=F,xlab="",ylab="")
                text(x=0,y=0,translateToPrint("Sorry, no curves matched your criteria."),cex=1.5)
                dev.off()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]