[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
a vector of indices of the largest elements in a vector not exceeding the elements of some other vector
- Subject: a vector of indices of the largest elements in a vector not exceeding the elements of some other vector
- From: derek(at)milkyway.gsfc.nasa.gov (Derek Hullinger)
- Date: 12 Jul 2001 11:05:47 -0700
- Newsgroups: comp.lang.idl-pvwave
- Organization: http://groups.google.com/
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:25674
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?