I get an error, could you guys help me to figure out?
이전 댓글 표시
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
Image Analyst
2014년 9월 1일
I can't read it. Please have one line of code per line. Please read this and fix your post: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Stephen23
2015년 2월 7일
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?"
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!