String/Array
in
Programming Questions
•
10 months ago
I am trying to declare and populate a 2D string array.
Not working.
I think it is in how I am declaring the 'variable'... this still confuses me.
String[][] catTable;
String[] theFile = loadStrings("catagories.csv"); // NB lookup table to translate column labels in another list
for (int i = 0; i < theFile.length; i++) {
for (int j = 0; j < 2; j++) { // THERE ARE ONLY 2 COLUMNS
String[] pieces = split(theFile[i], ",");
String catTable[j][i] = pieces[j];
println (catTable[j][i]+" : "+pieces[j]);
}
}
Run like this I get error "expected semi, got 'catTable' " suggests "syntax error, maybe missing a semicolon"
But I think this isn't it.
if I comment out the lines referring to the 'catTable[][]' inside the loops it tells me the variable catTable isn't defined.
I've seen something similar done with 2D array, but it apparently used 'active' rather than 'passive' mode. Yet another thing that confuses.
Any help would be appreciated, just getting started in Processing.
1