Last active
June 25, 2017 13:48
-
-
Save miho/70400af857b4f697dcc5dd291018ffcf to your computer and use it in GitHub Desktop.
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
package eu.mihosoft.vrl.user; | |
@ComponentInfo(name="CSVReader", category="Custom") | |
public class CSVReader implements java.io.Serializable { | |
private static final long serialVersionUID=1L; | |
// ---- add your code here ----- | |
public void plot( | |
@ParamInfo(name="CSV File", style="load-dialog", options="") File input, | |
@ParamInfo(name="Separator", options="value=\",\"") String sep, | |
@ParamInfo(name="Column", style="default", options="value=0") int col) { | |
input.eachLine{l-> | |
l = l.trim(); | |
String[] numbers = l.split(sep); | |
String stringVal = numbers[col]; | |
double value = java.lang.Double.parseDouble(stringVal); | |
// do something with the value | |
println("VAL: " + value) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment