Agents coding work but need add on two variable data

So far so good. Now, you probably see some output, right? Something like:

46.383,62.939,
39.73,6.828,
...

Not this exact output, of course… but the contents of your CSV file. A bunch of numbers, separated by commas.

So, as I have said, the next step is to use split(). If you took the time to find the Reference page for this function, you would already have all the information you need.

https://processing.org/reference/split_.html

Again, try to understand what the split() function does, and then attempt to use it in your own code yourself. The goal here is to get just ONE number per line!

void setup() {
  size(600, 600);
  String [] data; 

  data = loadStrings( "Spellman.csv" );
  println("there are " + data.length + " data");
  for (int i = 0; i < data.length; i++) {
    // Tell which line we are looking at now.
    println( "Now looking at line # " + i + ", which is " + data[i] );
    // Parse this line... somehow...
    float[] numbers_on_this_line = ???; // Try to fill in the rest of this line.
    // Show every number we found on this line.
    for( int j=0; j < numbers_on_this_line.length; j++){ println( "" + i + ", " + j + " => " + numbers_on_this_line[j] );}
  }
}
1 Like