Got Questions? Get Answers.
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

Thread Subject:
A question about clabel.m

Subject: A question about clabel.m

From: Yuri Geshelin

Date: 13 Mar, 2008 14:04:57

Message: 1 of 1

A question about clabel.m

In function plus_labels, we pull the x- and y-coordinates
of all contours in arrays x and y.
We then construct a complex variable

xylist = (x .* yrange + sqrt(-1) .* y .* xrange);

Next, we do a similar thing with the coordinates of a
clicked point xx and yy:

xy = xx .* yrange + sqrt(-1) .* yy .* xrange;

Now we use function 'min' to find the index of the point,
at which the minimal distance between the two vectors is
achieved. All right, I understand this. But why multiplying
x by yrange and y by xrange in both cases? What is the
purpose of such mirror multiplication? It simply rescales x
and y by a factor.

I verified: removal of xrange, yrange from the above 2
statements does not change anything.
Am I missing something?

(Same with function inline_labels, although I did not check



Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us