how to make the best use of memory when running MATLAB.?

now i have an array includes numeric its size is 7 x 7 and i do some operation on that array
clc
clear
a = input('Please, select your array: ');
b = nonzeros(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 problem during the implementation of the code this problem lies in the memory . please help me how to make the best use of memory when running MATLAB ?

8 件のコメント

mohammad
mohammad 2014 年 7 月 9 日
please help me necessary
Joseph Cheng
Joseph Cheng 2014 年 7 月 9 日
It may depend on your implementation, any more detail about your b and d variables? as a 7x7 matrix i was able to do nchoosek for the entire 7x7 (49 long array) choosing 5 for k. what are your n and k values that are failing memory? Can you give more detail on your problem as saying there is not enough memory to do something, all i can say is get more memory without seeing how you're trying to do this.
have you attempted to rethink the problem to see how to optimize or not have to do this?
mohammad
mohammad 2014 年 7 月 13 日
how to make the best use of memory when running MATLAB? this is just my issue and i have searched in matlab help department but without avail
per isakson
per isakson 2014 年 7 月 13 日
mohammad
mohammad 2014 年 7 月 14 日
THANK YOU PER ISAKSON I'LL TRY TO UNDERSTAND
per isakson
per isakson 2014 年 7 月 14 日
I assume you already did read
and other topics in the documentation
mohammad
mohammad 2014 年 7 月 16 日
Error using vertcat Out of memory. Type HELP MEMORY for your options.
Error in nchoosek>combs (line 165) P = [P; [v(ones(size(Q,1),1),k) Q]]; %#ok
Error in nchoosek (line 122) c = combs(v,k);
Error in testt (line 7) e{d} = nchoosek(b, d); that is the message which appears to me each time
per isakson
per isakson 2014 年 7 月 16 日
Are you sure there is enough memory to run your script? If so you need to debug your script. See
and start with
dbstop if error

サインインしてコメントする。

回答 (1 件)

per isakson
per isakson 2014 年 7 月 16 日
編集済み: per isakson 2014 年 7 月 29 日

0 投票

Try
>> e = nchoosek((1:7*7)',24);
which returns
Error using nchoosek (line 120)
Maximum variable size allowed by the program is exceeded.
with my system: R2013a, 64bit, Win7, 8GB

カテゴリ

ヘルプ センター および File Exchange で Elementary Math についてさらに検索

質問済み:

2014 年 7 月 9 日

編集済み:

2014 年 7 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by