I am using this block of code to get all the combinations of the rows of a matrix as I have to apply brute force.

You are watching: Maximum variable size allowed by the program is exceeded.

function combinations(training)S=dec2bin(1:2^size(training,1)-1)=="1";allSubsets=cell(size(S,1),1);for i=1:size(S,1) allSubsetsi=training(S(i,:),:); display(allSubsetsi)endendIf I run this function on a small matrix of lets say 7 or even 20 rows it works perfectly fine. But once I increase the size of the matrix to 25 it gives me this error.

Out of memory. Type HELP MEMORY for your options.

Error in dec2bin (line 55) s=char(rem(floor(d*pow2(1-max(n,e):0)),2)+"0");

Error in combination (line 11) S=dec2bin(1:2^size(training,1)-1)=="1";

Moreover, when I increase the number of rows up to 120 it gives me the following error :/

Maximum variable size allowed by the program is exceeded. Error in combination (line 11) S=dec2bin(1:2^size(training,1)-1)=="1";

I have to run this on a data of 2000 rows having 69 columns. Please help!!

matlab combinations
Improve this question
edited Nov 15 "17 at 14:06
Ali Hassan
asked Nov 15 "17 at 13:58

Ali HassanAli Hassan
133 bronze badges
Add a comment |


Active Oldesns Votes

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Thanks for contributing an answer to Stack Overflow!

Please be sure to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

See more: Westside Federation For Senior And Supportive Housing Community

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Facebook
Sign up using Email and Password

Post as a guest

Email Required, but never shown

Post as a guest


Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged matlab combinations or ask your own question.

The Overflow Blog
Featured on Meta
Matlab - Assignment into array causes error: "Maximum variable size allowed by the program is exceeded"
maximum size for an array in Matlab
Generating all possible combinations for selecting a particular number of rows in a large matrix
Maximum variable size allowed by the program is exceeded-MATLAB
MATLAB Error: Maximum Variable Size Allowed on the Device Is Exceeded
find the best combination of columns in a matrix
How to select a combination which gives me maximum accuracy of that row/combination?
Hot Network Questions more hot questions

Question feed
Subscribe to RSS
Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader.


Stack Overflow
Company type of
Stack Exchange Network-related
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.9.22.40280

Stack Overflow works best with JavaScript enabled

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.