Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

find the distance between one point and an object

Asked by Tiger on 1 May 2013

example

A=[ 0 1 1 1 1 0 0 ; 1 0 0 0 1 0 0 ; 1 1 0 0 0 0 *]

find the Eucilidean distance between * and all the nonzero points

in this case

the distance is sqrt(2^2+1^2)=sqrt(5)

Thank you!!

0 Comments

Tiger

Products

No products are associated with this question.

1 Answer

Answer by Image Analyst on 1 May 2013

How did you get that? Why don't you have a 3 by 7 array of distances? Or a 1D list of 8 distances? Why is it just a single number? Is this homework (so we know to give you hints, rather than just tall you outright how to do it)? Do you know about the find() function, which returns the row and column of the 1's? Why don't you figure out how to use that (hint, hint)?

0 Comments

Image Analyst

Contact us