Processing, 类Table中的addColumn()用法介绍。
用法
.addColumn().addColumn(title).addColumn(title, type)
参数
title(String)用于新列的标题type(int)用于新列的类型:INT、LONG、FLOAT、DOUBLE 或 STRING
返回
void
说明
使用 addColumn() 将新列添加到 Table 对象。通常,您需要指定一个标题,以便以后可以通过名称轻松引用该列。 (如果未指定标题,则新列的标题将为 null 。)还可以指定列类型,在这种情况下,此列中存储的所有值必须属于同一类型(例如,Table.INT 或 Table.FLOAT)。如果未指定类型,则使用默认类型STRING。
例子
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
相关用法
- Processing Table.addRow()用法及代码示例
- Processing Table.matchRow()用法及代码示例
- Processing Table.findRow()用法及代码示例
- Processing Table.getInt()用法及代码示例
- Processing Table.setString()用法及代码示例
- Processing Table.setFloat()用法及代码示例
- Processing Table.findRows()用法及代码示例
- Processing Table.clearRows()用法及代码示例
- Processing Table.getFloat()用法及代码示例
- Processing Table.removeColumn()用法及代码示例
- Processing Table.removeTokens()用法及代码示例
- Processing Table.getColumnCount()用法及代码示例
- Processing Table.rows()用法及代码示例
- Processing Table.getRowCount()用法及代码示例
- Processing Table.removeRow()用法及代码示例
- Processing Table.getString()用法及代码示例
- Processing Table.getRow()用法及代码示例
- Processing Table.setInt()用法及代码示例
- Processing Table.getStringColumn()用法及代码示例
- Processing Table.matchRows()用法及代码示例
- Processing TableRow.setFloat()用法及代码示例
- Processing Table用法及代码示例
- Processing TableRow.setString()用法及代码示例
- Processing TableRow.getInt()用法及代码示例
- Processing TableRow.getString()用法及代码示例
注:本文由纯净天空筛选整理自processing.org大神的英文原创作品 Table.addColumn()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
