help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Data Manipulation Problem - Vectorization


From: Thomas D. Dean
Subject: Re: Data Manipulation Problem - Vectorization
Date: Mon, 04 Feb 2013 14:27:44 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 02/04/13 02:43, Juan Pablo Carbajal wrote:

If you use the geometry package you can calculate the distances
between your points and the polygon defining the square. Of course you
could do this by hand as well.

Is this helping you?

This is it, exactly.

octave:29> A=load('20130202-run1.array');
octave:30> P1=[0 0; 0 100; -100 100; -100 0; 0 0];
octave:30> plot(distancePointPolygon([A(:,[5,6])],P1))

Now, I just need to extract the polygon from A(:,[10,11]))

octave5 > n=size(A,1);
octave:6> idx=A(1:n-1,[10,11]) != A(2:n,[10,11]);
octave:7> P1=A(2:n,[10,11]);
octave:8> P1=P1(idx(:,1) != idx(:,2),:)
ans =

     0   100
  -100   100
  -100     0
     0     0
  -100     0
  -100   100
     0   100
     0     0

Thanks.

Tom Dean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]