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

Home » Public Forums » archive » Re: Problem on where function
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: Problem on where function [message #68792] Thu, 03 December 2009 01:24
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On 2 Dez., 12:15, "M. Katz" <MKatz...@yahoo.com> wrote:
> You can also use the count argument in where.
>
> Index = where(arr GT th, count)
>
> arr[count-1] is the last element.
> Having count also lets you test for the case where there are no
> results.
>
> if (count GT 0) then begin
>   ...
> endif

I think arr[index[count-1]] is the last element. is't it?
Re: Problem on where function [message #68796 is a reply to message #68792] Wed, 02 December 2009 12:15 Go to previous message
M. Katz is currently offline  M. Katz
Messages: 69
Registered: May 2005
Member
You can also use the count argument in where.

Index = where(arr GT th, count)

arr[count-1] is the last element.
Having count also lets you test for the case where there are no
results.

if (count GT 0) then begin
...
endif
Re: Problem on where function [message #68818 is a reply to message #68796] Tue, 01 December 2009 02:39 Go to previous message
a.mozafari1211 is currently offline  a.mozafari1211
Messages: 16
Registered: February 2009
Junior Member
On 1 Dez., 02:18, tonyhey <andi.b.walt...@googlemail.com> wrote:
> res = arr[index[n_elements(index)-1]]
>
> On 1 Dez., 11:13, ali mozafari <a.mozafari1...@googlemail.com> wrote:
>
>
>
>> Hi
>> I  used where function to extract from one array a property. Like
>> this:
>> Index=where(arr gt th)
>> Th is a threshold
>> Now arr[index[0]] give us the first member with the specified
>> threshold. My problem is I can’t find the end member. I used something
>> like this:
>> Print, arr[n_elements[index]]
>> But it’s give me wrong answer.
>> Could somebody help me for this?
>> A.

Thanks Tony
Cheers
Re: Problem on where function [message #68869 is a reply to message #68818] Tue, 01 December 2009 02:18 Go to previous message
Andi Walther is currently offline  Andi Walther
Messages: 5
Registered: March 2009
Junior Member
res = arr[index[n_elements(index)-1]]

On 1 Dez., 11:13, ali mozafari <a.mozafari1...@googlemail.com> wrote:
> Hi
> I  used where function to extract from one array a property. Like
> this:
> Index=where(arr gt th)
> Th is a threshold
> Now arr[index[0]] give us the first member with the specified
> threshold. My problem is I can’t find the end member. I used something
> like this:
> Print, arr[n_elements[index]]
> But it’s give me wrong answer.
> Could somebody help me for this?
> A.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Headless build
Next Topic: match_3d.pro

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

Current Time: Wed Oct 08 15:27:31 PDT 2025

Total time taken to generate the page: 0.00598 seconds