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

Home » Public Forums » archive » Re: executing a string in VM without using 'EXECUTE'
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: executing a string in VM without using 'EXECUTE' [message #50636] Fri, 06 October 2006 02:42
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
I'm assuming your formula is just a sample, and that it could be any
other function of mr? I have the same problem (I posted something
similar a few months back). The conclusion was that the solution is to
write a code to break down the string and pass the pieces to the right
operators or functions (using call_function() ) to assemble the result.
It's not an entirely trivial excercise... so far I still working with
execute().


Look here - seems you're trying to do something very similar:
http://groups.google.de/group/comp.lang.idl-pvwave/browse_fr m/thread/d240948579293504

regards,
Greg

gav wrote:
> Hi Guys,
>
> There is probably a simple solution to this but I can't find it: I
> want to execute the string below in VM, without using (can't use) the
> 'EXECUTE' command. Any ideas / code etc greatfully received.
>
>
> com='speci=where('+formula+',speccount) ';write executable
> string
> t=execute(com) ;execute string
>
> the 'formula' is "(mr(*,*,159) le 8 or mr(*,*,170) gt mr(*,*,159)
> or mr(*,*,235) gt mr(*,*,159) )"
> cheers
Re: executing a string in VM without using 'EXECUTE' [message #50637 is a reply to message #50636] Fri, 06 October 2006 02:40 Go to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
gav wrote:
> There is probably a simple solution to this but I can't find it: I
> want to execute the string below in VM, without using (can't use) the
> 'EXECUTE' command. Any ideas / code etc greatfully received.
>
> com='speci=where('+formula+',speccount) ';write executable
> string
> t=execute(com) ;execute string
>
> the 'formula' is "(mr(*,*,159) le 8 or mr(*,*,170) gt mr(*,*,159)
> or mr(*,*,235) gt mr(*,*,159) )"

extract constants in the array indexing, and the limits with the
strmid/stregex functions. Turn them into variables, and build the
equation that way. Something like this:

b = stregex(formula,
'([0-9]+)[^0-9]+([0-9]+)[^0-9]+([0-9]+)[^0-9]+([0-9]+)[^0-9] +([0-9]+)[^0-9]+([0-9]+)',
/extract, /sub)
speci=where(mr[*,*,long(b[1])] le long(b[2]) or mr[*,*,long(b[3])] gt
mr[*,*,long(b[4])] or mr[*,*,long(b[5])] gt mr[*,*,long(b[6])],
speccount)

That is , assuming the structure of the formula remains the same, only
the values change. If you want something more general, you have to
explain where teh string comes from.

Maarten
Re: executing a string in VM without using 'EXECUTE' [message #50638 is a reply to message #50637] Fri, 06 October 2006 02:30 Go to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
Gav,

Maybe I'm missing something but if your 'formula' is fixed then you
don't need execute at all, you can just write:

speci=where(mr[*,*,159] le 8 or $
mr[*,*,170] gt mr[*,*,159] or $
mr[*,*,235] gt mr[*,*,159],speccount)

Execute is only required when the code you're going to be running isn't
known at compile time. For instance if you had an interactive program
where a user could type IDL syntax into a text widget or at the command
line.

Thanks,

Allan

gav wrote:
> Hi Guys,
>
> There is probably a simple solution to this but I can't find it: I
> want to execute the string below in VM, without using (can't use) the
> 'EXECUTE' command. Any ideas / code etc greatfully received.
>
>
> com='speci=where('+formula+',speccount) ';write executable
> string
> t=execute(com) ;execute string
>
> the 'formula' is "(mr(*,*,159) le 8 or mr(*,*,170) gt mr(*,*,159)
> or mr(*,*,235) gt mr(*,*,159) )"
> cheers
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: executing a string in VM without using 'EXECUTE'
Next Topic: Re: wrapper functions

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

Current Time: Wed Oct 08 13:51:59 PDT 2025

Total time taken to generate the page: 0.00666 seconds