Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (23 sloc) 765 Bytes
// Learning Processing
// Daniel Shiffman
// Example 18-2: Graphing comma separated numbers from a text file
int[] data;
void setup() {
size(480, 270);
// The text from the file is loaded into an array.
String[] stuff = loadStrings("data.txt");
// This array has one element because the file only has one line.
// Convert String into an array of integers using ',' as a delimiter
// Later we'll see how we can do this with the Table class
data = int(split(stuff[0], ',' ));
void draw() {
for (int i = 0; i < data.length; i ++ ) {
// The array of ints is used to set the color and height of each rectangle.
rect(i*64, 0, 20, data[i]);
You can’t perform that action at this time.