From: "Zeinab Al-Rekabi" <>
Newsgroups: comp.soft-sys.matlab
Subject: Logicals, winding number, -inpolgon
Date: Fri, 20 Mar 2009 14:11:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <gq085l$bpd$>
Reply-To: "Zeinab Al-Rekabi" <>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1237558261 12077 (20 Mar 2009 14:11:01 GMT)
NNTP-Posting-Date: Fri, 20 Mar 2009 14:11:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1426744
Xref: comp.soft-sys.matlab:526434


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