After a thorough survey of this and many other Internet communities I failed to solve my problem. It is about ControlP5 button and my aim of importing 2D array from previously formated text file with two columns and 19 rows and space separated values. Now my code works but the 2D arrray I designated to hold the values from the txt does not get all of the values but just the last pair in its first row. I know that for loops over all values but stores them only in the first row. I dont know how to push it in another row for reading. This is my code:
if(theEvent.isController()) { if(theEvent.controller().name() == "mean shape males") { String loadPath1 = selectInput(); reader = createReader(loadPath1); //new BufferedReader int x=0; //rows int y=0; //columns String smaLine; try { while ((smaLine = reader.readLine()) != null) { String[] values = smaLine.split(", "); for(int i = 0; i < values.length; i++) { float[] testC = float(split(values[i], " ")); for (int j = 0; j < testC.length; j++) { mat1[j][i] = testC[j]; //THIS IS THE PROBLEMATIC MATRIX that I declared before setup() with good dimensionality } } x = x+1; } } catch (IOException e) { e.printStackTrace(); } mat1max = maxRet(mat1); mat1min = minRet(mat1); inputMat = new Grid(2,19,10,130,22,mat1,mat1min,mat1max);
I was wondering about the experiences using various solutions to math/statistics solution to use in a Processing app. Namely, I used mainly Jama and Apache Commons math for simple matrix manipulation but in the long run it becomes tedious to write code for i.e. discriminant analysis. So I came up with two possibilities, because I mainly work with R:
1. JRI/Rengine/rJava solutions
2. Clojure/Incanter
As for number one solution it seems to work when including Rengine .jars in the sketch folder but for that R and Rserver must be working. Also there are sometimes path-related problems and plus I`n not sure is is possible to even publish working app as standalone. Does anyone knows is there a possibility of Processing reading data structure that is currently hanging in the R workspace?
As for Clojure/Incanter it seemed to me very interesting because R-like syntax but even as incanter.processing library exists I don`t know how to invoke Incanter from Processing or is that a possibility at all?
I know this is a rather dull and 1000 times answered type of question but I had problems that drove me crazy. Now I know where and how should I make Processing import outside Java class packages by putting them in the Libraries folder in Sketchbook in Documents...and I am sure that I do everything right but some packages just won`t be recognized.
So if anyone has a little time to test how can this package be imported in Processing I would be forever grateful...The package name is commons-math-2.2 and the address is
http://commons.apache.org/math/...
Has anyone been using JAMA package in Processing projects? I need some basic matrix manipulation and I managet to create Matrix object but no luck in implementing methods like Matrix.times(Matrix), etc.
I don`t even know what is in question but... When reading from a file (etc. from .txt) Processing forces me to write down the whole path to that file irrespective of the fact that the file in question is already in that project`s data folder. Now I don`t know what to do? and especially when exporting the applet I need thath .txt data to go with it so I am stuck for further development. Any ideas?
This being my first post I am sorry that it has to be a question but every start is not easy. I need just to limit the run time of the Brownian motion line example at the Processing website for a custom amount of time or a possible mouse click. Also at the presumed end of the run I should get the last two coordinates that were randomly chosen in order to plot a little ellipse with them at that very spot.
Thanks in advance, and I feel welcomed already....