title: Reduce multidimensional array in processing to drop empty odd rows
body: <p>I have the following problem, I imported a file .csv into a 2d array called csv.</p>
  
  <p>This has null entries in each odd row, therefore just even rows, starting from 0 (0, 2, 4, ... 606) are filled with data relevant for me</p>
  
  <p>so, the size of the 2d array is 609, 560 and they come from printing csv.length and csv[1].length</p>
  
  <p>I need to have a file whose size is 304x561, and I call it csv2.</p>
  
  <p>However, the following code gives me an error</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>String rows[] = loadStrings("cit2.txt");
  String [][] csv; // initialize csv file
  String [][] csv2; // initialize reduced csv file
  int csvWidth=0;
  
  //calculate max width of csv file
  for (int i=0; i &lt; rows.length; i++) {
    String [] columns = split(rows[i],'\t'); 
    if (columns.length&gt;csvWidth){
      csvWidth=columns.length;
    }
  }
  
  
  //create csv array based on # of rows and columns in csv file
  csv = new String [rows.length][csvWidth];
  
  //parse values into 2d array
  for (int i=0; i &lt; rows.length; i++) {
    String [] temp = new String [rows.length];
    //strDelimiter = (strDelimiter || ",");
  
    temp= split(rows[i], '\t');
    for (int j=0; j &lt; temp.length; j++){
     csv[i][j]=temp[j];
    }
  }
  
  //test
  println(csv[604][0]);
  println(csv.length);
  println(csv[0].length);
  
  int row = csv.length;
  println(((row-1)/2));
  int newrow = 0;
  
  int col = csv[0].length;
  //int row = csv.length;
  
  
  csv2 = new String [((row-1)/2)-1][col];
  
  for (int c=0; c &lt;csv[0].length; c++)
  {
    for(int r=0; r&lt;(csv.length)-1; r = r+2)
    {
      String temp = csv[r][c]; 
      newrow = newrow +1; 
      csv2[newrow][c]= temp;
    }
  }
  </code></pre>
  
  <p>any idea?</p>