I get an error, could you guys help me to figure out?

1 visualizzazione (ultimi 30 giorni)
Error using bsxfun
Out of memory. Type HELP MEMORY for your options.
Error in classreg.learning.internal.wnanmean (line 12)
X = bsxfun(@times,X,W);
Error in pca (line 284)
mu = classreg.learning.internal.wnanmean(x, vWeights);
Error in princomp (line 29)
[varargout{1:nargout}]=pca(varargin{1},'Algorithm','svd','Economy',fEconomy);
Error in pca_for_Zhen (line 36)
[coeff, score, latent]=princomp(data,'econ');
[fname pname]=uigetfile('*.*','Please click any image in your folder');
cd(pname);
filenamelist=dir(pwd);
nel=length(filenamelist);
index=0;
sampleImage=im2double(imread(fname));
vsampleImage=sampleImage(:);
[numRows numCols]=size(sampleImage);
data=zeros(size(vsampleImage,1),200);
label='Zhen sample';
for i=3:1:102
if filenamelist(i).isdir~=1
if mod(i,1)==0
index=index+1
fname=filenamelist(i).name;
tempData=im2double(imread(fname));
data(:,index)=tempData(:);
end
end
end
[coeff, score, latent]=princomp(data,'econ');
n=score>=0;
posscore=n.*score;
m=score<=0;
negscore=m.*score;
figure
for j=1:9
subplot(3,3,j)
pcolor(reshape(score(:,j),numRows,numCols));axis image;shading flat;axis ij;
text(5,20,[label ' ' sprintf('%d',j)],'Color','w','FontWeight','bold')
axis off;
colormap jet;
end
cd('..');
impos(:,:,1)=reshape(posscore(:,2),numRows,numCols);
impos(:,:,2)=reshape(posscore(:,3),numRows,numCols);
impos(:,:,3)=reshape(posscore(:,4),numRows,numCols);
for k=1:3
impos(:,:,k)=impos(:,:,k)/max(max(impos(:,:,k)));
end
figure
image(impos);
axis image;
title([label ' Positive']);
imneg=zeros(numRows,numCols);
imneg(:,:,1)=reshape(-negscore(:,2),numRows,numCols);
imneg(:,:,2)=reshape(-negscore(:,3),numRows,numCols);
imneg(:,:,3)=reshape(-negscore(:,4),numRows,numCols);
for k=1:3
imneg(:,:,k)=imneg(:,:,k)/max(max(imneg(:,:,k)));
end
figure
image(imneg);
axis image;
title([label ' Negative']);
imoverlay=zeros(numRows,numCols);
for k=1:3
imoverlay(:,:,k)=impos(:,:,k)+imneg(:,:,k);
imoverlay(:,:,k)=imoverlay(:,:,k)/max(max(imoverlay(:,:,k)));
end
figure
image(imoverlay);
axis image;
title([label ' Overlay']);
  2 Commenti
Stephen23
Stephen23 il 7 Feb 2015
Please:
  • Reduce the code down to a minimal working example (MWE) that reproduces the error. Note that this might actually solve the problem, but if it doesn't, then edit your post:
  • Format the code to be more readable.
  • Describe what is being run, what you expect, what you get.
And please use a more descriptive title than "I get an error, could you guys help me to figure out?"

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by