Maximize size of a 3D matrix

I would like to create a 38000x50x100 matrix of random integers. I am using the expression:
q = randi([0 10],38000,50,100);
I am getting "out of memory" errors down to a 8000. Is there any way of getting around this problem without creating several matrices that total 38000?
Thanks- ericsp

 Accepted Answer

Maybe use a different class:
q = randi([0 10],38000,50,100,'int8');

1 Comment

Thanks James
This worked great. Actually I used 'uint8'.

Sign in to comment.

More Answers (1)

Sean de Wolski
Sean de Wolski on 16 May 2012
You must be on a 32 bit system and have already used much of your memory. On a 64bit system you can make that matrix no problem: It requires 1520000000 bytes.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!