This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
Class | Table |
Name |
addColumn() |
Examples |
Table table;
void setup() {
table = new Table();
table.addColumn("name");
table.addColumn("age", Table.INT);
table.addColumn("height", Table.FLOAT);
TableRow newRow = table.addRow();
newRow.setString("name", "Jermaine");
newRow.setInt("age", 15);
newRow.setFloat("height", 4.567);
saveTable(table, "data/new.csv");
}
// Sketch saves the following to a file called "new.csv":
// name,age,height
// Jermaine,15,4.567
|
Description |
Use addColumn() to add a new column to a Table object. Typically, you will want to specify a title, so the column may be easily referenced later by name. (If no title is specified, the new column's title will be null.) A column type may also be specified, in which case all values stored in this column must be of the same type (e.g., Table.INT or Table.FLOAT). If no type is specified, the default type of STRING is used.
|
Syntax | .addColumn()
.addColumn(title)
.addColumn(title, type) |
Parameters |
title |
String: the title to be used for the new column |
type |
int: the type to be used for the new column: INT, LONG, FLOAT, DOUBLE, STRING, or CATEGORY |
|
Returns | void |
Related | removeColumn()
|
Updated on May 19, 2014 05:30:04pm PDT