Re: Problem on where function [message #68792] |
Thu, 03 December 2009 01:24 |
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  |
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  |
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  |
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.
|
|
|