arrays - Input-Looping Matrix Dimensions Must Agree -


i've got error:

    error using  - matrix dimensions must agree.     error in distmatrix3 (line 23)        d=sqrt((i-l').^2+(j-m').^2+(k-n').^2);      error in coba (line 20)         d=distmatrix3(cobat,c);   % calculate distance 

and here code:


i think error isn't because of distmatrix3 itself. caused c inputs, looping input. , guess these lines should fixed since doesn't contain j variables:

for i=1:k     f=find(g==i);     if f                % calculate new centroid          c(i,:)=mean(cobat(find(g==i),:),1);     end end 

i'm stuck on how should fix it. can guys tell me should solve this? appreciated.

thank you.

the code :

[maxrow, maxcol]=size(cobat); i=1:k     j=1:maxcol         c=input('enter number: '); % sequential initialization     end end 

seems unlikely correct.

should like:

[maxrow, maxcol]=size(cobat); i=1:k     j=1:maxcol         c(i,j)=input('enter number: '); % sequential initialization     end end 

i'm wondering whether user input k should equal maxrow.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -