MATLAB: “Maximum variable size allowed by the program is exceeded.” When using the syndtable command

communicationcommunication system toolboxerrorhamming

I've been working on some Hamming codes recently. Then I got my H matrix which is a 64×72 matrix and i want to make a decoding table (syndrome table) using the command "syndtable(H)"
every time i do that command i get the error:
t = syndtable(H4) ??? Error using ==> zeros Maximum variable size allowed by the program is exceeded.
Error in ==> syndtable at 28 table = zeros(2^n_k,n);
Anyone know what am I doing wrong ?

Best Answer

Hi,
n_k is 64 so
>>2^n_k
ans =
1.8447e+19
and n is 72. The code calls zeros(2^n_k,n) which would requiere a total amount of elements:
>> (2^n_k)*n
ans =
1.3282e+21
However the maximum amount of elements in any array/matrix is:
[~,max_elements] = computer
max_elements =
2.8147e+14
which is lower than the amount you requested. So you get the error you are facing.
In addition, if that limit wouldn't exist you would need a huge amount of memory in order to store that double matrix:
>>(1.3282e+21)*8/1024^4
ans =
9.6639e+09
So 9.6e+09 TB of memory.