We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I have not used this in-built Table class earlier(loadTable), kinda paranoid using this.. Compared to using loadStrings.. Anyway, I had a basic questions- Is there a way, I can make "for (TableRow row : table.rows()) {" in terms of "i"? Quoting from the table example Secondly, in the example given, is it possible to store the results in an array for later use instead of this?
for (TableRow row : table.rows()) {
int id = row.getInt("id");
String species = row.getString("species");
String name = row.getString("name");
}
I wanna store in an array instead of this method..
Answers
Perhaps declare a helper iterator before the enhanced
for
loop block? :-??Right thanks! Wait, this is the best way to go right? I mean storing all values before in arrays to use other places..(I hope so).. But, is there a way I can convert "TableRow rows: lines.rows()" in terms of "i", like- int i = 0; i < lines.length; i++ or something?
Dunno why you'd want a regular
for
loop for? But here it goes something: (:|Thanks
Hey, seems a lil problem; Getting row 856 does not exist; I am not sure my for loop is okay! table = loadTable("entre.tsv", "header"); println(table);
ALSO, why can't I use "getIntColumn"; giving me error! Why? http://processing.org/reference/javadoc/core/processing/data/Table.html#getIntColumn(int)
The error is probably more in the line 7, where you try to access the row of index row count. Remember that in Java, indexes go from 0 to n-1, so it should be row count - 1. Beside, the loop has no point, as you don't update row. Ie. you read it once, then you loop on it.
Study again the code from GoToLoop.
"giving me error!"
What error? What version of Processing do you have? How do you try to use it?