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.

Name

Table

Examples
Table table;

void setup() {

  table = new Table();
  
  table.addColumn("id");
  table.addColumn("species");
  table.addColumn("name");
  
  TableRow newRow = table.addRow();
  newRow.setInt("id", table.lastRowIndex());
  newRow.setString("species", "Panthera leo");
  newRow.setString("name", "Lion");
  
  saveTable(table, "data/new.csv");
}

// Sketch saves the following to a file called "new.csv":
// id,species,name
// 0,Panthera leo,Lion
Description Table objects store data with multiple rows and columns, much like in a traditional spreadsheet. Tables can be generated from scratch, dynamically, or using data from an existing file. Tables can also be output and saved to disk, as in the example above.
Methods
addColumn() Adds a new column to a table
removeColumn() Removes a column from a table
getColumnCount() Gets the number of columns in a table
getRowCount() Gets the number of rows in a table
clearRows() Removes all rows from a table
addRow() Adds a row to a table
removeRow() Removes a row from a table
getRow() Gets a row from a table
rows() Gets multiple rows from a table
getInt() Get an integer value from the specified row and column
setInt() Store an integer value in the specified row and column
getFloat() Get a float value from the specified row and column
setFloat() Store a float value in the specified row and column
getString() Get an String value from the specified row and column
setString() Store a String value in the specified row and column
getStringColumn() Gets all values in the specified column
findRow() Finds a row that contains the given value
findRows() Finds multiple rows that contain the given value
matchRow() Finds a row that matches the given expression
matchRows() Finds multiple rows that match the given expression
removeTokens() Removes characters from the table
trim() Trims whitespace from values
Constructor
Table()
Table(rows)
RelatedloadTable()
saveTable()
TableRow
Updated on May 19, 2014 05:30:04pm PDT

Creative Commons License