comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: find positions in vectors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: find positions in vectors [message #62030] Thu, 21 August 2008 01:47
thomas.jagdhuber@dlr. is currently offline  thomas.jagdhuber@dlr.
Messages: 19
Registered: February 2007
Junior Member
On 21 Aug., 09:11, Craig Markwardt
<craigm...@REMOVEcow.physics.wisc.edu> wrote:
> "thomas.jagdhuber" <thomas.jagdhu...@gmail.com> writes:
>> On 20 Aug., 22:16, Jeremy Bailin <astroco...@gmail.com> wrote:
>>> On Aug 20, 4:01 pm, "thomas.jagdhuber" <thomas.jagdhu...@gmail.com>
>>> wrote:
>
>>>> Dear experts,
>
>>>> another question:
>
>>>> I have two vectors (simplified):
>
>>>> a= [1,2,3,4,5,6,7,8]
>>>> b=[2,5,7]
>
>>>> now I want to find the positions in the vector a which contains no
>>>> values of b. I know that it is working with the histogram-function.
>>>> And I can do it for integers, but in reality my values are floats
>>>> between 0.0 and 50.0. and that is the point where I got problems!
>
>>>> Best wishes,
>
>>>> thomas
>
>>> I always use Craig's CMSET_OP for that sort of thing:
>
>>> http://cow.physics.wisc.edu/~craigm/idl/arrays.html
>
>>> -Jeremy.
>
>> actually this is working now. perfect, thanks a lot! I have the values
>> now. Next problem: Is there an elegant method to find now the position
>> of each value of b (which is not contained in the vector a) inside the
>> vector b. Because the where-function can only be used for one value,
>> which ends up in using a for loop over the values of b.
>
> Do you mean, like,
> cmset_op(a, 'AND', /not2, b, /index)
> ??
>
> :-)
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigm...@REMOVEcow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------

Sorry, stupid! thanks a lot ,this is really elegant!!!
Re: find positions in vectors [message #62033 is a reply to message #62030] Thu, 21 August 2008 00:11 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"thomas.jagdhuber" <thomas.jagdhuber@gmail.com> writes:

> On 20 Aug., 22:16, Jeremy Bailin <astroco...@gmail.com> wrote:
>> On Aug 20, 4:01 pm, "thomas.jagdhuber" <thomas.jagdhu...@gmail.com>
>> wrote:
>>
>>
>>
>>> Dear experts,
>>
>>> another question:
>>
>>> I have two vectors (simplified):
>>
>>> a= [1,2,3,4,5,6,7,8]
>>> b=[2,5,7]
>>
>>> now I want to find the positions in the vector a which contains no
>>> values of b. I know that it is working with the histogram-function.
>>> And I can do it for integers, but in reality my values are floats
>>> between 0.0 and 50.0. and that is the point where I got problems!
>>
>>> Best wishes,
>>
>>> thomas
>>
>> I always use Craig's CMSET_OP for that sort of thing:
>>
>> http://cow.physics.wisc.edu/~craigm/idl/arrays.html
>>
>> -Jeremy.
>
> actually this is working now. perfect, thanks a lot! I have the values
> now. Next problem: Is there an elegant method to find now the position
> of each value of b (which is not contained in the vector a) inside the
> vector b. Because the where-function can only be used for one value,
> which ends up in using a for loop over the values of b.

Do you mean, like,
cmset_op(a, 'AND', /not2, b, /index)
??

:-)

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: find positions in vectors [message #62034 is a reply to message #62033] Wed, 20 August 2008 23:25 Go to previous message
thomas.jagdhuber@dlr. is currently offline  thomas.jagdhuber@dlr.
Messages: 19
Registered: February 2007
Junior Member
On 20 Aug., 22:16, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Aug 20, 4:01 pm, "thomas.jagdhuber" <thomas.jagdhu...@gmail.com>
> wrote:
>
>
>
>> Dear experts,
>
>> another question:
>
>> I have two vectors (simplified):
>
>> a= [1,2,3,4,5,6,7,8]
>> b=[2,5,7]
>
>> now I want to find the positions in the vector a which contains no
>> values of b. I know that it is working with the histogram-function.
>> And I can do it for integers, but in reality my values are floats
>> between 0.0 and 50.0. and that is the point where I got problems!
>
>> Best wishes,
>
>> thomas
>
> I always use Craig's CMSET_OP for that sort of thing:
>
> http://cow.physics.wisc.edu/~craigm/idl/arrays.html
>
> -Jeremy.

actually this is working now. perfect, thanks a lot! I have the values
now. Next problem: Is there an elegant method to find now the position
of each value of b (which is not contained in the vector a) inside the
vector b. Because the where-function can only be used for one value,
which ends up in using a for loop over the values of b.

greets,

thomas
Re: find positions in vectors [message #62039 is a reply to message #62034] Wed, 20 August 2008 13:16 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Aug 20, 4:01 pm, "thomas.jagdhuber" <thomas.jagdhu...@gmail.com>
wrote:
> Dear experts,
>
> another question:
>
> I have two vectors (simplified):
>
> a= [1,2,3,4,5,6,7,8]
> b=[2,5,7]
>
> now I want to find the positions in the vector a which contains no
> values of b. I know that it is working with the histogram-function.
> And I can do it for integers, but in reality my values are floats
> between 0.0 and 50.0. and that is the point where I got problems!
>
> Best wishes,
>
> thomas

I always use Craig's CMSET_OP for that sort of thing:

http://cow.physics.wisc.edu/~craigm/idl/arrays.html

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Duplicate objects
Next Topic: Font size and axis range in 'IDLgrAxis' class

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:01:37 PDT 2025

Total time taken to generate the page: 0.12508 seconds