I'm loading a CSV-file containing some x & y coordinates, which looks like this:
Code:X Coordinate,Y Coordinate
992890,157287
1004879,167415
1024193,225136
1035310,241442
990688,160138
1034264,244077
1043763,212028
1000513,171618
Ofcourse, I'd like to split the values and store them in an array. I do so by doing this:
Code:void setup() {
size(800,800);
drawVisualization("data.csv");
};
void drawVisualization(String path) {
String[] raw = loadStrings(path);
// loop through the dataset
// skip the first descriptive line
for(int line = 1; line < raw.length; line++) {
String[] trees = split(raw[line], ","); //split the raw data and store in the array
println(trees[line]); //print the array
};
}
however, if I look in my output all I see is
Code:157287
Which means that the Split() function seems to break after the first line. The CSV-file does not seem to contain any bogus characters at the end of each line. The CSV has a length of 2250 lines, but shortening it to 200 lines does not make any difference..
Any idea what's causing this behavior?