Hello there,
I'm writing a MATLAB program that will generate a matrix with 1 million rows and an unknown amount of columns (at max 1 million).
I tried pre-allocating this matrix:
a=zeros(1000000,1000000)
but I received the error that the "Maximum variable size allowed by the program is exceeded."
I have a feeling that not pre-allocating this matrix will seriously slow the code down.
This made me curious: what is the maximum pre-allocation size in MATLAB?
Update
Thanks guys for the insightful answers.
I'm a novice at Matlab and programming altogether, so I guess I never really thought about what it means to create an array of one trillion elements ;)
I'm going to look into sparse matrices, because the result I am aiming for in this particular problem will be a matrix consisting for the larger part of zeros.
Thanks again for your help, I'm very impressed by the level of knowledge here.
-Pieter