Mostrar comentarios más antiguos
Hi, I'm trying to find middle distance. We did it this way
c1=handles.centroids(:,1);
c2=handles.centroids(:,2);
d1=sqrt(((xi(:,1)-c1))^2+(yi(:,1)-c2)^2);
d11=sqrt(((xi(:,2)-c1))^2+(yi(:,2)-c2)^2);
vz1=(d1+d11)/2;
str = ['strední vzdalenost v prvním okně je ', num2str(d1), ' pixelu.'];
disp (str);
but my voice is a mistake vcem Does anybody know the problem?
??? Error using ==> mpower
Inputs must be a scalar and a square matrix.
Thank you very much
Respuestas (1)
Andrei Bobrov
el 11 de Abr. de 2012
use .^
d1=sqrt(((xi(:,1)-c1))^2+(yi(:,1)-c2)^2);
d11=sqrt(((xi(:,2)-c1)).^2+(yi(:,2)-c2).^2);
on comment
d = sqrt((xi-c1).^2+(yi-c2).^2);
vz1 = mean(d);
5 comentarios
Adam
el 11 de Abr. de 2012
Jan
el 11 de Abr. de 2012
@Adam: The error message is clear: You try to access a not existing element of the array xi. Because you did not explain or show how xi is created, it is impossible to give any advice.
Adam
el 11 de Abr. de 2012
Adam
el 13 de Abr. de 2012
Adam
el 13 de Abr. de 2012
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!