Maximum variable size allowed by the program is exceeded.

It's occuring in the knnclassifier!!! Need help!
Error:
Maximum variable size allowed by the program is exceeded.
Code:
function D = distfun(Train, Test, dist)
%DISTFUN Calculate distances from training points to test points.
[n,p] = size(Train);
D = zeros(n,size(Test,1));
numTest = size(Test,1);
switch dist
case 'sqeuclidean'
for i = 1:numTest
D(:,i) = sum((Train - Test(repmat(i,n,1),:)).^2, 2);
end
case 'cityblock'
for i = 1:numTest
D(:,i) = sum(abs(Train - Test(repmat(i,n,1),:)), 2);
end
.
.
.

1 件のコメント

Jan
Jan 2013 年 1 月 24 日
Please mention the line, which causes the error.

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

 採用された回答

Daniel Shub
Daniel Shub 2013 年 1 月 24 日

0 投票

The maximum variable size depends on your OS and MATLAB version. Assuming a recent 64-bit OS and 64-bit MATLAB, the maximum variable size (~8 TB) is such that you probably don't have enough processing power to do anything with it effectively. For 32-bit systems and some older 64-bit systems you might actually have the processing power to use such a large matrix and could benefit from a OS/MATLAB upgrade.

1 件のコメント

Lester Lim
Lester Lim 2013 年 1 月 25 日
I tried separating the data, it also works but I have to put in all parts...

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by