Set your presentation theme:
Black (default) -
White -
League -
Sky -
Beige -
Simple
Serif -
Blood -
Night -
Moon -
Solarized
H:
by Jean Pierre Charalambos
Universidad Nacional de Colombia
Presentation best seen online
See also the source code
H:
- Tabular data
H:
Table table = loadTable("data.csv");
V:
x | y | diameter | name |
---|---|---|---|
160 | 103 | 43.19838 | Happy |
372 | 137 | 52.42526 | Sad |
273 | 235 | 61.14072 | Joyous |
121 | 179 | 44.758068 | Melancholy |
int val1 = table.getInt(2, 1); // val now has the value 235
float val2 = table.getFloat(3, 2); // val2 now has the value 44.758068
String s = table.getString(0, 3); // s now has the value “Happy”
V:
x | y | diameter | name |
---|---|---|---|
160 | 103 | 43.19838 | Happy |
372 | 137 | 52.42526 | Sad |
273 | 235 | 61.14072 | Joyous |
121 | 179 | 44.758068 | Melancholy |
TableRow row = table.getRow(2); // Gets the third row (index 2)
int x = row.getInt("x"); // // x has the value 273
int y = row.getInt("y"); // y has the value 235
float d = row.getFloat("diameter"); // d has the value 61.14072
String s = row.getString("name"); // s has the value “Joyous”
V:
for (int i = 0; i<table.getRowCount(); i++) {
// Access each row of the table one at a time, in a loop.
TableRow row = table.getRow(i);
float x = row.getFloat("x");
float y = row.getFloat("y");
float d = row.getFloat("diameter");
String n = row.getString("name");
// Do something with the data of each row
}
V:
//Create a new row.
TableRow row = table.addRow();
//Set the values of all columns in that row.
row.setFloat("x", mouseX);
row.setFloat("y", mouseY);
row.setFloat("diameter", random(40, 80));
row.setString("name", "new label");
saveTable(table, "data/data.csv");
Refer to save table
V:
Table table = loadTable("data.csv", "header"); //see https://processing.org/reference/loadTable_.html)
removeRaw()
findRows()
matchRows()
H: