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

Home » Public Forums » archive » Re: Succinct way of testing array membership
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Succinct way of testing array membership [message #81204 is a reply to message #81203] Thu, 30 August 2012 09:59 Go to previous messageGo to previous message
Russell Ryan is currently offline  Russell Ryan
Messages: 122
Registered: May 2012
Senior Member
On Thursday, August 30, 2012 12:51:48 PM UTC-4, godber wrote:
> Is there a more succinct way of testing array membership than using where and n_elements on the indexes? Something like array_contains(a, 'pancakes')?
>
>
>
> Austin

wouldn't that just be liek this:

suppose:
t=['pancakes','eggs','milk','sausage'] ;array to test

then:
g=where(strmatch(t,'pancakes',/fold),n) ;the line testing it
if n ne 0 then print,'Its in the array!'


-russell
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: A simple DLM question
Next Topic: plotting symbols on map using direct graphics 8.2

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

Current Time: Fri Oct 10 04:26:47 PDT 2025

Total time taken to generate the page: 0.16057 seconds