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

Home » Public Forums » archive » a vector of indices of the largest elements in a vector not exceeding the elements of some other vector
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
a vector of indices of the largest elements in a vector not exceeding the elements of some other vector [message #25734] Thu, 12 July 2001 11:05
derek is currently offline  derek
Messages: 1
Registered: July 2001
Junior Member
I have two vectors of different sizes (say, A and B):

A contains floating point values that increase with index
B contains floating point values

I'd like to create a third vector, C (which would be the same size as
B) such that:

The nth element in C contains the index of the largest element in A
that does not exceed the nth element in B.

**

For example:

if

A=[10,20,30,40]
B=[12,37]

then

C=[0,2],

because the 0th element in A is the largest value in A that does not
exceed 12, and the 2nd element in A is the largest value in A that
does not exceed 37.

**

I have found a way to do this if B is a single floating point value
(not a vector of values):

temp=max(A<B,C)

but I haven't been able to find a way to do this with a vector B. Any
ideas?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Easy way to do superscripts, greek letters, etc.?
Next Topic: Re: a vector of indices of the largest elements in a vector not exceeding the elements of some other vector

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

Current Time: Wed Oct 08 14:52:05 PDT 2025

Total time taken to generate the page: 0.00450 seconds