You are attempting to create a matrix with more elements than the maximum number of elements allowed in MATLAB.
Common causes: MATLAB will attempt to create a matrix with a large number of elements, as long as that number of elements is less than the maximum number of elements allowed in a matrix. You can determine this maximum using the COMPUTER function in the following way.
[str, maxsize] = computer
Solution: If the matrix you are attempting to create has relatively few nonzero elements, you may be able to create it as a sparse matrix. You can use the SPARSE function and the other sparse matrix manipulation functions to create and manage this matrix. Type
for a list of the sparse matrix manipulation functions. Note, however, that the limitation on the maximum number of elements still exists; now it only applies to the nonzero elements of the sparse matrix. If your matrix is not sparse, however, you will need to break it into sections with a number of elements less than the maximum returned by the COMPUTER function.