Method that outputs contents of Table and TableRow objects into the console #4396

Closed
Niels-NTG opened this Issue Apr 7, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@Niels-NTG

As someone who does many data driven projects I make a lot of use of the Processing Table object. But debugging a Table is always a very awkward exercice. Each time I have to write little helper methods like these:

println(table.getColumnTitles());
for (TableRow row : table.rows()) {
    for (int i = 0; i < row.getColumnCount(); ++i) {
        print(row.getString(i) + " ");
    }
    println();
}

… to get a sense of what's happening to my data.

It would be very nice if Processing Tables and TableRows had a build-in method that outputs the contents of these objects as a nicely formatted string or console output.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry May 8, 2016

Member

Good idea, added for 3.1. You can use print() to print a Table or TableRow, or use write(PrintWriter) for more flexible use. They weren't included before since there isn't a natural "representation" of a table to be used. Both write out tab-delimited entries (though maybe print() should use a different representation that includes the column indices...)

Also remember saveTable() which can give you intermediate versions (you can even programmatically load them with launch()).

Member

benfry commented May 8, 2016

Good idea, added for 3.1. You can use print() to print a Table or TableRow, or use write(PrintWriter) for more flexible use. They weren't included before since there isn't a natural "representation" of a table to be used. Both write out tab-delimited entries (though maybe print() should use a different representation that includes the column indices...)

Also remember saveTable() which can give you intermediate versions (you can even programmatically load them with launch()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment