Noob... UNO maxed out but Mega wont run Matrix?

You have 1032 LED's (24x43) at four bytes each so that's over 4000 bytes. Your XYTable is another 2000 or so? You might be reaching the limit of what the Mega can hold.

I recommend you put XYTable in FLASH memory:
const uint16_t XYTable[] PROGMEM = {

You will have to fetch the values from PROGMEM:

  uint8_t i = (y * kMatrixWidth) + x;
  uint8_t j = pgm_read_word(&XYTable[i]);
  return j;

WARNING: Your table contains values over 255 but you are returning only the bottom 8 bits (uint8_t). You should probably make 'j' uint16_t.