Reference+
Class Name
Table
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.
Additional Table methods are documented in the Processing
Table Javadoc.
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
Constructors
Table()
Table(rows)
Methods
addColumn()
Adds a new column to a tableremoveColumn()
Removes a column from a tablegetColumnCount()
Returns the total number of columns in a tablegetRowCount()
Returns the total number of rows in a TableclearRows()
Removes all rows from a TableaddRow()
Adds a new row of data to a Table objectremoveRow()
Removes a row from a Table objectgetRow()
Returns a reference to the specified TableRowrows()
Gets all rows from the tablegetInt()
Retrieves an integer value from the Table's specified row and columnsetInt()
Stores an integer value in the Table's specified row and columngetFloat()
Retrieves a float value from the Table's specified row and columnsetFloat()
Stores a float value in the Table's specified row and columngetString()
Retrieves a String value from the Table's specified row and columnsetString()
Stores a String value in the Table's specified row and columngetStringColumn()
Retrieves all values in the specified columnfindRow()
Finds a row that contains the given valuefindRows()
Finds multiple rows that contain the given valuematchRow()
Finds a row that matches the given expressionmatchRows()
Finds multiple rows that match the given expressionmatchRowIterator()
Finds multiple rows that match the given expressionremoveTokens()
Removes characters from the tabletrim()
Trims whitespace from valuessort()
Orders a table based on the values in a column
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.