From: ade77 on 3 Feb 2010 15:28 "ratnesh kumar" <iam_ratnesh(a)yahoo.co.in> wrote in message <hkckia$jq2$1(a)fred.mathworks.com>... > hi, > thanks for giving me suggestions.but nchoose create problem when their is large string.it is slow also.for S=[S3(1:15)] this is ok but when iam using S=[S1,S2,S3] > matlab gives problem of "out of memory". > > iam using these code same problem occured > S1 =[3 20 21 22 23 25 26 27 28 29 30 62 66 69 71 72 74 75 77 80 82 83 84 85 86 89]; > S2=[90 92 96 99 101 103 105 107 111 114 115 116 117 118 119 124 125 127 129 131 137 141 144 24 67 68]; > S3=[70 87 88 95 98 100 104 110 112 121 134]; > %for > S=[S3(1:5)] %%%*******change > > > N = numel(S); > S = S(:).' ; % make the set a row vector, for uniform output > p2=2.^(N-1:-1:0); % This part of the formula can be taken out of the loop > nm=(2^(N-1)) > for i=1:nm, > W{i}= S(bitget((2*i-1)*p2,N) > 0) ; > end > celldisp(W) > > > provide me solution > thanks functions 'nchooosek', and 'perms' and probably a little loop will solve this problem
From: ratnesh kumar on 3 Feb 2010 15:35 "ade77 " <ade100a(a)gmail.com> wrote in message <hkcm8i$7n4$1(a)fred.mathworks.com>... > "ratnesh kumar" <iam_ratnesh(a)yahoo.co.in> wrote in message <hkckia$jq2$1(a)fred.mathworks.com>... > > hi, > > thanks for giving me suggestions.but nchoose create problem when their is large string.it is slow also.for S=[S3(1:15)] this is ok but when iam using S=[S1,S2,S3] > > matlab gives problem of "out of memory". > > > > iam using these code same problem occured > > S1 =[3 20 21 22 23 25 26 27 28 29 30 62 66 69 71 72 74 75 77 80 82 83 84 85 86 89]; > > S2=[90 92 96 99 101 103 105 107 111 114 115 116 117 118 119 124 125 127 129 131 137 141 144 24 67 68]; > > S3=[70 87 88 95 98 100 104 110 112 121 134]; > > %for > > S=[S3(1:5)] %%%*******change > > > > > > N = numel(S); > > S = S(:).' ; % make the set a row vector, for uniform output > > p2=2.^(N-1:-1:0); % This part of the formula can be taken out of the loop > > nm=(2^(N-1)) > > for i=1:nm, > > W{i}= S(bitget((2*i-1)*p2,N) > 0) ; > > end > > celldisp(W) > > > > > > provide me solution > > thanks > > functions 'nchooosek', and 'perms' and probably a little loop will solve this problem thanks ......i tried nchoosek but it not provide solution for bigger data. "out of memory " error??
From: Ravi Chilumula on 3 Feb 2010 16:05
ratnesh, what is your final goal with a list of all the final combination set?...tht might help us think abt workarounds...I just want to remind you that the final set gets extremely big...I ran in to memory problems too..there might be other ways of doing this, but one option could be saving the data intermediately..if its of anyuse this is my sample code which u probably wrote already... S1 =[3 20 21 22 23 25 26 27 28 29 30 62 66 69 71 72 74 75 77 80 82 83 84 85 86 89]; S2=[90 92 96 99 101 103 105 107 111 114 115 116 117 118 119 124 125 127 129 131 137 141 144 24 67 68]; S3=[70 87 88 95 98 100 104 110 112 121 134]; S=[S1 S2 S3]; totalNoComb =0; %total number of combinations for j=1:length(S) totalNoComb = totalNoComb + nchoosek(63,6); end %get final set total_comb_cell={}; for j=1:length(S) c = combnk(S,j); total_comb_cell{j}=c; clear c end "ratnesh kumar" <iam_ratnesh(a)yahoo.co.in> wrote in message <hkcmmb$573$1(a)fred.mathworks.com>... > "ade77 " <ade100a(a)gmail.com> wrote in message <hkcm8i$7n4$1(a)fred.mathworks.com>... > > "ratnesh kumar" <iam_ratnesh(a)yahoo.co.in> wrote in message <hkckia$jq2$1(a)fred.mathworks.com>... > > > hi, > > > thanks for giving me suggestions.but nchoose create problem when their is large string.it is slow also.for S=[S3(1:15)] this is ok but when iam using S=[S1,S2,S3] > > > matlab gives problem of "out of memory". > > > > > > iam using these code same problem occured > > > S1 =[3 20 21 22 23 25 26 27 28 29 30 62 66 69 71 72 74 75 77 80 82 83 84 85 86 89]; > > > S2=[90 92 96 99 101 103 105 107 111 114 115 116 117 118 119 124 125 127 129 131 137 141 144 24 67 68]; > > > S3=[70 87 88 95 98 100 104 110 112 121 134]; > > > %for > > > S=[S3(1:5)] %%%*******change > > > > > > > > > N = numel(S); > > > S = S(:).' ; % make the set a row vector, for uniform output > > > p2=2.^(N-1:-1:0); % This part of the formula can be taken out of the loop > > > nm=(2^(N-1)) > > > for i=1:nm, > > > W{i}= S(bitget((2*i-1)*p2,N) > 0) ; > > > end > > > celldisp(W) > > > > > > > > > provide me solution > > > thanks > > > > functions 'nchooosek', and 'perms' and probably a little loop will solve this problem > thanks ......i tried nchoosek but it not provide solution for bigger data. > "out of memory " error?? |