The loadTable() function is used to read the contents of a file or URL and create a p5.Table object from it. The options parameter can be used to define the type of format that the data is expected to be read. All the files loaded and saved are in UTF-8 encoding.
This function is asynchronous, therefore it is recommended to be called in the preload() function to ensure that the function is executed before the other functions.
loadTable(filename, options, [callback], [errorCallback])
loadTable(filename, [callback], [errorCallback])
Parameters: This function accepts four parameter as mentioned above and described below.
- filename: This is a string which denotes the file path or URL from where the data has to be loaded.
- options: It is a string which denotes the format of the file to be loaded. It can be either “csv” which loads the table using comma-separated-values or “tsv” which loads the table using tab-separated-values. Also the value “header” can be specified to denote if the table has a header value. Multiple commands can be used by passing them as separate parameters. It is an optional parameter.
- callback: This is a function which is called when this function executes successfully. The first argument for this function is the XML data loaded from the file. It is an optional parameter.
- errorCallback: This is a function which is called if there is any error in executing the function. The first argument for this function is the error response. It is an optional parameter.
Below examples illustrate the loadTable() function in p5.js:
Online editor: https://editor.p5js.org/
- How to get the function name inside a function in PHP ?
- PHP | abs() Function
- p5.js | mag() Function
- PHP | Ds\Set contains() Function
- PHP | cos( ) Function
- D3.js | d3.map.set() Function
- PHP | sin( ) Function
- PHP | ord() Function
- p5.js | int() function
- PHP | each() Function
- CSS | var() Function
- PHP | Ds\Set last() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.