We are about to switch to a new forum software. Until then we have removed the registration on this forum.
line 206 in http://piratepad.net/2qUISlwOK7
error "The function saveTable(Table, String) does not exist"
saveTable() definitely exists in Processing Reference guide, and I think I've used the arguments right, so why am I getting this error?
Thanks!
Answers
do you try this in a .js or processing context?
It won't run in the browser I guess...
processing version is = ?
Greetings, Chrisir ;-)
I'm just trying to run it in Processing editor.
Processing2.1.1.
Even just saveTable(); throws an error saying the function does not exist.
Oh, in Processing and in Java mode, I haven't fiddled with the mode at all, ever.
Table is a new Processing 2's class. JS Mode is Processing 1! [..]
I can't spot it, sry...
It seems like http://processing.org/reference/saveTable_.html might be out of date?
http://processing.org/reference/javadoc/core/processing/core/PApplet.html#saveTable(processing.data.Table, java.lang.String)
Looks like some slightly different syntax here - http://stackoverflow.com/questions/18955163/how-to-append-results-in-processing
meanGroupSizePerType is an array of integer arraylists, which has already been filled by this stage in the program. finish() is a new method to export my summary measures to csv file, because the dataset is too big to transpose from horizontal to columns in Excel.
I'm definitely using Processing2.1.1 in standard Java mode.
Thanks!
saveTable() definitively exists, and if I make a sketch like:
I don't have a compilation error.
The code you show is partial, so we lack some context. The World class seems to be defined outside of a PApplet context: you use System.out.println() instead of println(), for example. Is it in the .java file?
On the other hand, render() uses classical PApplet functions, but perhaps the compiler haven't spotted them yet...
Hi Phil,
thanks, here's the file - http://piratepad.net/2qUISlwOK7 (it's part of a sketch, with other files, but I think everything potentially relevant is in that one).
Line 213 is where the saveTable() function call is.
World class is declared like this:
I'm a beginner (biologist not a CS student) recently fallen in the deep end, so I only slightly understand what you're talking about with PApplets. I don't think I've done anything unusual or clever that would clash with PApplet definitions in Processing, at least not deliberately!
Thanks!
Processing's IDE has a very useful auto-formatting feature invoked by CTRL+T! <:-P
If you had used it, you woulda noticed that method finish() is lacking a closing curly brace
}
! [-(Hiya, yes I use Ctrl+T very frequently, but there was a lot more code in between this snipet and the closing curly brace, which was commented out at the time. There was a closing curly brace tho, otherwise I get a "unexpected token void" error - have done several times, but that wasn't the source of the saveTable() function does not exist error.
A friend who's a brilliant coder helped me over the phone, and we wrote an equivalent function using PrintWriter. In case anyone else gets stuck on the same thing and finds this later, here it is, hope it saves you days of frustration struggling with saveTable()!
I called pw1 because I have a pw2 etc.
General point I found really useful - if you want to transpose the orientation of an arraylist[] or [][] in order to get your data over timesteps in rows in the console window or in an exported file, then
the outer loop will always give you rows
the inner loop will always give you columns
So, if you've got an array of arraylists, like my meanGroupSizePerType Arraylist[], and you want to print it out to the Console or export to a file in an orientation that you don't have to transpose later in Excel (because Excel will only transpose about 13,000 columns into rows, in theory, and in practice it seems to crash whenever I tried to transpose more than 10,000), then you'll want to
loop over the elements in each arraylist first, e.g. meanGroupSizePerType[0].size(), starting at [0], then loop over the array, e.g. meanGroupSizePerType.length.
The first loop through the arraylists starts at [0], just like i = 0, or whatever iterator you have, but when it gets to the second loop it will go through the length of your array, so don't worry about initializing it at [0] in the first loop.
Hope that helps someone!
"here's the file - http://piratepad.net/2qUISlwOK7 [...] Line 213"
There are less than 30 lines in the page you link to. I can't take a look at the line 213...
Oh, sorry, but that was five days ago and I've re-used that piratepad since...
That error got resolved anyway.
Thanks!
Bad idea (the reuse of links), don't forget threads are here to be read by whoever search them...
Sorry, I won't do it again, and I'll upload my complete code somewhere public when I've finished and re-post a link here and say which line this was about. Fair point, sorry.