@@ -1120,18 +1120,21 @@ p5.Table.prototype.getNum = function(row, column) {
1120
1120
* var table;
1121
1121
*
1122
1122
* function preload() {
1123
- * //my table is comma separated value "csv "
1124
- * //and has a header specifying the columns labels
1123
+ * // table is comma separated value "CSV "
1124
+ * // and has specifiying header for column labels
1125
1125
* table = loadTable('assets/mammals.csv', 'csv', 'header');
1126
1126
* }
1127
1127
*
1128
1128
* function setup() {
1129
- * var tableArray = table.getArray();
1130
- *
1131
- * //output each row as array
1132
- * for (var i = 0; i < tableArray.length; i++) {
1133
- * print(tableArray[i]);
1134
- * }
1129
+ * print(table.getString(0, 0)); // 0
1130
+ * print(table.getString(0, 1)); // Capra hircus
1131
+ * print(table.getString(0, 2)); // Goat
1132
+ * print(table.getString(1, 0)); // 1
1133
+ * print(table.getString(1, 1)); // Panthera pardus
1134
+ * print(table.getString(1, 2)); // Leopard
1135
+ * print(table.getString(2, 0)); // 2
1136
+ * print(table.getString(2, 1)); // Equus zebra
1137
+ * print(table.getString(2, 2)); // Zebra
1135
1138
* }
1136
1139
* </code>
1137
1140
* </div>
@@ -1140,6 +1143,7 @@ p5.Table.prototype.getNum = function(row, column) {
1140
1143
* no image displayed
1141
1144
*
1142
1145
*/
1146
+
1143
1147
p5 . Table . prototype . getString = function ( row , column ) {
1144
1148
return this . rows [ row ] . getString ( column ) ;
1145
1149
} ;
@@ -1213,6 +1217,38 @@ p5.Table.prototype.getObject = function(headerColumn) {
1213
1217
*
1214
1218
* @method getArray
1215
1219
* @return {Array }
1220
+ *
1221
+ * @example
1222
+ * <div class="norender">
1223
+ * <code>
1224
+ * // Given the CSV file "mammals.csv"
1225
+ * // in the project's "assets" folder
1226
+ * //
1227
+ * // id,species,name
1228
+ * // 0,Capra hircus,Goat
1229
+ * // 1,Panthera pardus,Leoperd
1230
+ * // 2,Equus zebra,Zebra
1231
+ *
1232
+ * var table;
1233
+ *
1234
+ * function preload() {
1235
+ * // table is comma separated value "CSV"
1236
+ * // and has specifiying header for column labels
1237
+ * table = loadTable('assets/mammals.csv', 'csv', 'header');
1238
+ * }
1239
+ *
1240
+ * function setup() {
1241
+ * var tableArray = table.getArray();
1242
+ * for (var i = 0; i < tableArray.length; i++) {
1243
+ * print(tableArray[i]);
1244
+ * }
1245
+ * }
1246
+ * </code>
1247
+ * </div>
1248
+ *
1249
+ *@alt
1250
+ * no image displayed
1251
+ *
1216
1252
*/
1217
1253
p5 . Table . prototype . getArray = function ( ) {
1218
1254
var tableArray = [ ] ;
0 commit comments