Vivek Rao wrote:
> I wish there were a MATCH(IVAL,ARRAY,[DIM],[MASK]) intrinsic function in
> Fortran, patterned after MINLOC, that would return the location of the
> first element of ARRAY having the same value as IVAL . It would be most
> useful for arrays of type integer, character, and logical. For a real
> ARRAY, the user could specify the tolerance used to define equality. If
> there were no match, an array of zeros would be returned.
>
It's not real elegant, but how about
minloc (abs(array-ival), [dim], [mask])
as a stop gap? It's easy to add a tolerance for reals. For
characters you'd need to change array == ival into numbers,
but a simple merge could do that. I'd think you could do
a generic module function to handle all of the interesting
cases.
Dick Hendrickson
> Comments?
>
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Mail - Find what you need with new enhanced search. Learn more.
> <http://us.rd.yahoo.com/evt=29917/*http://info.mail.yahoo.com/mail_250>
|