So I have a matrix M1 that I build at the beginning of my method each method call (this is all done in a non-static environment). The issue is that, depending on an integer index, say n I want the matrix M2 (in method call #2 for example) to contain rows 1, 2... n of M1 (the number of rows that I need for M changes each method call, but the number of columns persist).
My method in pseudocode;
int myMethod(numRows, numColumns, n) {
  Initialize M as matrix with dimensions(numRows, numColumns)
  if (n > 0) {
    **copy rows 1,2...,n from previous M matrix**
  }
  **do stuff with M**
  return M[numRows][numColumns];
What is a smart way to accomplish this? I hope it's clear what I'm asking for. Something worth noting is that Mi can be 'taller' or 'shorter' (it's always exactly as 'wide') as Mj for i > j
 
     
     
    