Reputation: 408
I need to create a matrix of Matlab, it's big matrix as below:
X = zeros(128,2e7);
when I run the command, it gives me an error of
Out of memory. Type HELP MEMORY for your options.
Is there a way to avoid that error?
Thank you
Upvotes: 0
Views: 90
Reputation: 36710
You are running the code
X = zeros(128,2e7);
An array of this size requires 128*2e7*8 Byte of storage. This is about 20GB. Considering an average PC, you probably don't have 20GB of ram available for MATLAB. The direct answer to your question is, NO you can not use more RAM than your PC has available.
Possible strategies are:
Upvotes: 1
Reputation: 1755
If it fits your use case, you could use a sparse matrix
There is also tall arrays
Upvotes: 3