Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
dimension mismatch error
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clc;
clear all;
allsamples=[];
for i=1:6
tic
a=imread(strcat('C:\Users\user\Documents\MATLAB\face','\',num2str(i),'.jpg'));
imshow(a);
b=a(1:112*92);
b=double(b);
allsamples=[allsamples;b];
toc
end
samplemean=mean(allsamples);
xmean=zeros();
for i=1:200
xmean(i,:)=allsamples(i,:)-samplemean;
end
from the above program i got the error message as
??? Subscripted assignment dimension mismatch.
Error in ==> example1 at 16
xmean(i,:)=allsamples(i,:)-samplemean;
how to clear this error plz help me
0 Kommentare
Antworten (1)
Andrei Bobrov
am 11 Mai 2012
pre-allocation:
xmean = zeros(200,size(allsamples,2));
OR:
xmean = bsxfun(@minus,allsamples(1:200,:),mean(allsamples));
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!