Displaying custom graphics on Adafruit 32x32 LED Matrix

I'm using an Arduino Uno with this amazing 32x32 LED Matrix board & driver from Adafruit (product #607):

I need to show a fast animation with icons that fill the screen and are displayed in a random order, but the method I'm using isn't working.

I was planing to use the matrix.drawPixel method that's part of the Adafruit library and create a series of arrays that represent the pixels for each icon. In other words, for 10 icons, I would have 10 arrays with 1024 elements each. I would then parse the array into 32 rows and columns.

Here's what an example array would look like:
const int icon1[]={
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,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1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0*
};

And here's how I am parsing and displaying it:
void loop() {

* for(int i=0;i<1024;i++){*
* int horiz = i%32;//find the H position*
* int vert = round(i/32);//find the V position*
_ if(icon1 == 1) {
* matrix.drawPixel(horiz, vert, matrix.Color333(7, 0, 0));//if this is a "1" light up a pixel, otherwise do nothing*
* }
}*_

* delay(500);*
* matrix.fillScreen(matrix.Color333(0, 0, 0));//clear the screen*
* delay(500);*
}
[/b]
What's happening is that this code is working for up to 64 elements in one array, and if I try to read any more than that the program doesn't load at all and I get a blank screen.
Any thoughts on what might be going on? (I'm thinking perhaps it's a memory issue?)
Any suggestions for a different way to do this?
Thanks in advance!

Actually, the code is

if(icon1*==1)*
I don't know how I managed to copy it differently.

Hi carladiana,

Your probably running out of RAM as your arrays are quite big. There are several options you can use to reduce RAM/memory use.
Have a look at storing the array data in program memory (Flash) instead of RAM here. Also changing the data type used from 'const int icon1[]={' to 'const byte icon1[]={' will halve the memory usage. Another option is to pack the data more tightly, as your only storing binary 0/1 bits you can reduce 8 bytes down to just one byte.
Your currently using 2048 bytes to store 1024 elements, changing data type from int to byte will reduce this to 1024 bytes and bit packing will reduce this to just 128 bytes.

I'm told by Adafruit that the libraries take up almost all the RAM, so this is likely the issue. I knew there was a way to compact the data, but wasn't sure what to search, so thank you for putting it so succinctly! I'll give all this a try and report back.

SO helpful!
Converted to bytes, and doubled the capacity as you had described, but that didn't get me far.

Went into PROGMEM and that opened a whole new world: PROGMEM - Arduino Reference

Also have been getting up to speed on bit packing:
http://playground.arduino.cc/Code/BitMath#bit_pack

And I also found this great blog post, which describes all three approaches, so I'm trying a modification of this code, which seems to be working:

Thank you, Riva!