Created
September 20, 2016 11:01
-
-
Save YujiSODE/9f1c9db6fbc6d4445334902211c2be39 to your computer and use it in GitHub Desktop.
it converts csv formatted text data into tab separated data for gnuplot.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//csv2GnuplotData.js | |
//it converts csv formatted text data into tab separated data for gnuplot | |
function csv2GnuplotData(title,csv){ | |
var slf=this.window,_csvD=csv.split(/,/),N=_csvD.length,I=0,txt='#'+title+'\n'+'#N='+N+'\n'; | |
var saveD=function(a){slf.location.href='data:application/octet-stream,'+encodeURIComponent(a);}; | |
while(I<N){txt+=I+'\t'+_csvD[I]+'\n',I+=1;} | |
txt+='#EOF'; | |
saveD(txt); | |
} | |
/* Copyright (c) 2016 Yuji SODE <yuji.sode@gmail.com> | |
* This is free. You can redistribute and/or modify it. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment