I am using element wise multiplication in MATLAB whereby the biggest matrices I have are 120x50 matrices. In the code below, weight_N_120{i,1}{j,1}
is a cell whereby the i
th cell contains 10000 other cells. In each of these 10000 cells, I have a matrix which is of dimension 120 by i
. The same goes for ind_ExRet_N{i,1}{j,1}
.
for i = 2:50
for j = 1:10000
weight_ExRet_NS{i,1}{j,1} = weight_N_120{i,1}{j,1}.*ind_ExRet_N{i,1}{j,1};
end
i
end
When I run this, I get an error:
{Error using .*
Out of memory. Type HELP MEMORY for your options.
Error in PCA (line 26)
weight_ExRet_NS{i,1}{j,1} = weight_N_120{i,1}{j,1}.*ind_ExRet_N{i,1}{j,1};
Error in run (line 64)
evalin('caller', [script ';']);
}
I realised it stopped running when i = 30
, so it means there is not enough memory to do element wise multiplication with two 120 by 30 matrices. How can I resolve this problem?