how to solve a problem associated with memory speed of computer ?

1 view (last 30 days)
first of all , i have a specific task that works at the expense of every possible combination of range , i already used a program that perform my purpose this code is :
clc
clear
a = input('Please, select your array: ')
b = a(:).'
c = length(b)
for d =1:c
if (d<c)
e{d} = nchoosek(b, d);
end
end
tt=cellfun(@(m) padarray(m,[0 max(cellfun(@(n) size(n,2), e)) - size(m,2)],'post'), e,'UniformOutput',0);
uu=cell2mat(tt([1:d-1])')
suu=size(uu)
uu(:,((suu(2))+1))=sum(uu')'
but i faced a big problem during the implementation of the program that this command :
e{d} = nchoosek(b, d) has failed to continue as result of the number of possible choices and number of selected choices and finally the limitations:
When b = nchoosek(n,k) is sufficiently large, nchoosek displays a warning that the resultmight not be exact. In this case, the result is only accurate to 15 digits for double-precision inputs, or 8 digits for single-precision inputs.
C = nchoosek(v,k) is only practical for situations where length(v) is less than about 15.
that's where my vector consist of the hundreds of numbers which i want to do this process on. when i run the program , then matlab is being busy until giving me out of memory error in a time and takes along time without implementation of the program then i am forced to out of the program . i looked for a solution by help "out of memory" but i failed to find any solution then i tried to use anther command that's
combnk(v,k)
but it takes along time without implementation of the program then i am forced to out of the program too please please please , i want to practical solution to perform a lot of processes like this for my work . If the solution depends on the capabilities of my computer tell me about that computer specifications which performs this program easily , quickly and immediately note that my computer specifications are : win 7 64 bit 4 GB RAM 2.3 cpu i3
  4 Comments

Sign in to comment.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!