|
Zeinab,
You simply use "logical indexing". Read the example given in the
help for INPOLYGON.
% Self-intersecting polygon
xv = rand(6,1); yv = rand(6,1);
xv = [xv ; xv(1)]; yv = [yv ; yv(1)];
x = rand(1000,1); y = rand(1000,1);
in = inpolygon(x,y,xv,yv);
plot(xv,yv,x(in),y(in),'.r',x(~in),y(~in),'.b')
The coordinates you are looking for are given by x(in), y(in)
Damian
"Zeinab Al-Rekabi" <nospam-rekabi570@yahoo.ca> wrote in message
news:gq085l$bpd$1@fred.mathworks.com...
> Hello
>
> I am trying to compute the winding number, which is the number of times
> that a closed curve encircles the point.
> I used the matlab function [IN]=inpolygon(X,Y,xv,yv), where X,Y are the
> points and xv,yv are the curves coutour (assuming 2d).
>
> I obtain a logical array nX1, which has 0s and 1s. 0s being outside the
> countour and 1s being inside the contour. My question: how do I convert
> such a logical array into the X,Y numbers which it originally was, so
> baiscally for those values that were 1, how do I get their X,Y values? Is
> there a matlab function that does this conversion and if not may anyone
> assist me in obtaining them.
>
> Thank you kindly
> Z
|