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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -