unable to print out the all possible answers, Out of memory and Maximum variable size allowed by the program is exceeded.
显示 更早的评论
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.
5 个评论
Sean de Wolski
2014-12-1
- Why do you need this?
- What are m and n?
Star Strider
2014-12-2
If you have the Statistics Toolbox, use combnk to calculate the size of your sequence series first. That you want to do it doesn’t mean it is possible, given finite computer memory.
Image Analyst
2014-12-2
Bear, that's not an answer to Sean's "Why" - you merely repeated what you think you want to do. What he's getting after is that perhaps it's possible to do what you want to do in a different way that doesn't require all of the possible combinations being in memory at exactly the same time. Plus you didn't answer what m and n are.
Stephen23
2014-12-2
Try buying a computer with infinite memory. That usually solves this kind of problem.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!