Re: Index of array from mask
- From: hiphop <ratel.gilles@xxxxxxx>
- Date: Wed, 30 Apr 2008 11:35:06 -0700 (PDT)
On Apr 30, 2:24 pm, "Michael Metcalf" <michaelmetc...@xxxxxxxxxxxxxx>
wrote:
"dpb" <n...@xxxxxxx> wrote in messagenews:fvad2l$tmh$3@xxxxxxxxxxx
Thomas Koenig wrote:
I think he was looking for an intrinsic on the order of COUNT() or
MAXLOC() but that would return the locations of array elements meeting the
mask conditions...
That isn't available directly...
Maybe:
program main
implicit none
integer, dimension(5) :: v
integer :: a, b, i
v = (/103,102,103,104,105/)
a = 102
b = 105
write (*,*) pack(v, mask = v > 102 .and. v <105)
end program main
Regards,
Mike Metcalf
Yes! With PACK function, I think is good.
ncount = COUNT(v > 102 .and. v <105)
myIndex(1:ncount) = PACK(v,mask = v > 102 .and. v <105)
Thanks
.
- References:
- Index of array from mask
- From: hiphop
- Re: Index of array from mask
- From: Thomas Koenig
- Re: Index of array from mask
- From: dpb
- Re: Index of array from mask
- From: Michael Metcalf
- Index of array from mask
- Prev by Date: Re: variable length of integer
- Next by Date: Re: Index of array from mask
- Previous by thread: Re: Index of array from mask
- Next by thread: Re: Index of array from mask
- Index(es):
Relevant Pages
|