Bookmark Topic Watch Topic
  • New Topic

Arrays.deepToString usage  RSS feed

 
Natasha Teokotai
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi

I have an array as follows

String[][] optionsArray = new String[][] {
weka.core.Utils.splitOptions ("-B 35 -M a"),
weka.core.Utils.splitOptions ("-C 0.25 _M 2")
}

When I try to printout the contents of this array using

getOut().println.("Contents of array: " + Arrays.deepToString(optionsArray[j]));

within a loop I get the following:

Contents of array: [,,,]

Help please

Natasha

 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Okay. So what is actually in the arrays when you print them? Just showing us some code which produces some output isn't helpful, as nobody has any way of predicting what output it might produce.
 
Natasha Teokotai
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
Paul Clapham wrote:Okay. So what is actually in the arrays when you print them? Just showing us some code which produces some output isn't helpful, as nobody has any way of predicting what output it might produce.


Sorry..................

My optionArrays looks like this..........

String[][] optionsArray = new String[][] {
weka.core.Utils.splitOptions ("-B 35 -M a"),
weka.core.Utils.splitOptions ("-C 0.25 -M 2"),
weka.core.Utils.splitOptions ("-F 3 -N 2.0 -O 2 -S 1 -E"),
}
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sorry, I guess I wasn't clear. What you posted there is not the contents of the array, it's some code which (when you run it) produces the contents of the array. To find the problem it's more practical to look at the actual contents of the array after that code runs. To find out what that is, put some debugging code into your program which prints out the actual contents.
 
Natasha Teokotai
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
Paul Clapham wrote:Sorry, I guess I wasn't clear. What you posted there is not the contents of the array, it's some code which (when you run it) produces the contents of the array. To find the problem it's more practical to look at the actual contents of the array after that code runs. To find out what that is, put some debugging code into your program which prints out the actual contents.


Weka information seems to talk about 'arrays'

Does this make it any clearer?
********************************************
Option handling
Weka schemes that implement the weka.core.OptionHandler interface, such as classifiers, clusterers, and filters, offer the following methods for setting and retrieving options:
void setOptions(String[] options)
String[] getOptions()
There are several ways of setting the options:
Manually creating a String array:
String[] options = new String[2];
options[0] = "-R";
options[1] = "1";
Using a single command-line string and using the splitOptions method of the weka.core.Utils class to turn it into an array:
String[] options = weka.core.Utils.splitOptions("-R 1");
*******************************************
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Report post to moderator
you should not need a loop to print the array; you only do it once.

Please continue the discussion here, because this seems to follow directly from that discussion.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!