Hey all, I have a code here to generate all the possible combinations of a binary sequence consisting m zeroes and n one. Input : m and n value, output the corresponding combinations of the binary sequence. When I input small values of m and n, the code works fine, but when i input some big values of m and n. The matlab output Out of memory. Type HELP MEMORY for your options.
Error in unique>uniqueR2012a (line 623) groupsSortA = sortA(1:numRows-1,:) ~= sortA(2:numRows,:);
Error in unique (line 147) [varargout{1:nlhs}] = uniqueR2012a(varargin{1},logical(flaginds(1:5)));
Error in randbinary (line 19) x1=unique(perms([zeros(1, m) ones(1, n)]), 'rows')
Error using perms (line 24) Maximum variable size allowed by the program is exceeded. The following is my code(helped by someone in matlab answers) to print out all the unique possible combinations: x1=unique(perms([zeros(1, m) ones(1, n)]), 'rows') Could anyone tell me why it is Out of memory and Maximum variable size allowed by the program is exceeded? and how to fix it.
Best Answer