[chronojump] graph.R solves encoder disconnected



commit 3e61b62591a0daf22e2d475e25c173152f36c3b3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 2 12:06:43 2012 +0800

    graph.R solves encoder disconnected

 encoder/graph.R |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index c40dfe9..7130748 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -368,6 +368,15 @@ if(length(args) < 3) {
 	png(outputGraph, width=width, height=height)
 
 	rawdata=scan(file=file,sep=",")
+
+	if(length(rawdata)==0) {
+		plot(0,0,type="n",axes=F,xlab="",ylab="")
+		text(x=0,y=0,"Encoder is not connected.",cex=1.5)
+		dev.off()
+		write("", outputData1)
+		quit()
+	}
+
 	rawdata.cumsum=cumsum(rawdata)
 
 	titleType = "execution"
@@ -387,7 +396,7 @@ if(length(args) < 3) {
 	#if not found curves with this data, plot a "sorry" message and exit
 	if(n == 1 & curves[1,1] == 0 & curves[1,2] == 0) {
 		plot(0,0,type="n",axes=F,xlab="",ylab="")
-		text(x=0,y=0,"Sorry, no curves matched your criteria",cex=1.5)
+		text(x=0,y=0,"Sorry, no curves matched your criteria.",cex=1.5)
 		dev.off()
 		write("", outputData1)
 		quit()



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