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

Home » Public Forums » archive » Re: Syntax Error Confusion
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: Syntax Error Confusion [message #55487] Fri, 24 August 2007 11:16 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ryan. writes:

> Here is my snippet of code: (The only thing before this is some
> declaration of variables)
>
> IF getdata THEN $
> snrarray = getsnrarray(wnrange, occlist, DATESARR=time, $
> /JULIAN, $
> OCCS2RM=occs2rm, WAVENUMS=wavenums) && $
>
> occ1snr = REFORM(snrarray[0,*]) && $
> occ2snr = REFORM(snrarray[1,*])

Your problem is this is NOT the way to write a BEGIN-END
block of code. In fact, you are forgetting the BEGIN and the END :-)

Are you SURE you want to be doing this in a batch file!?
Maybe there is an easier way. May I suggest a main-level
program. Then you don't have to jump through all these
&& $ hoops to get something done.

Cheers,

David

P.S. A main-level program is just like a batch file, except
it has an END at the end of it, and you compile it before you
run it. But all the variables are available to you at the main
IDL level, where it runs.

IDL> .run myprogram

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Syntax Error Confusion [message #55547 is a reply to message #55487] Mon, 27 August 2007 06:18 Go to previous message
rchughes is currently offline  rchughes
Messages: 26
Registered: April 2006
Junior Member
> Maybe there is an easier way. May I suggest a main-level
> program. Then you don't have to jump through all these
> && $ hoops to get something done.

Thanks David!

That has made my life a whole lot easier. I've tried it and it works
beautifully. Up to now I have tried to avoid creating batch files
that required more than 2 or 3 lines in a loop or conditional
statement and throwing them into a procedure with several keywords to
return (not pleasant, by the way) so a main-level program is just what
I needed without knowing I needed it.

Ryan.

P.S. I tried posting twice on Friday but it didn't go through, so this
is another attempt.
Re: Syntax Error Confusion [message #55582 is a reply to message #55487] Fri, 24 August 2007 20:16 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:

> Ryan. writes:
>
>> Here is my snippet of code: (The only thing before this is some
>> declaration of variables)
>>
>> IF getdata THEN $
>> snrarray = getsnrarray(wnrange, occlist, DATESARR=time, $
>> /JULIAN, $
>> OCCS2RM=occs2rm, WAVENUMS=wavenums) && $
>>
>> occ1snr = REFORM(snrarray[0,*]) && $
>> occ2snr = REFORM(snrarray[1,*])
>
> Your problem is this is NOT the way to write a BEGIN-END
> block of code. In fact, you are forgetting the BEGIN and the END :-)
>
...
> program. Then you don't have to jump through all these
> && $ hoops to get something done.

I have a colleague who has never written a single IDL procedure or
.run'able script. He has huge snippets which he pastes directly into
the IDL window. They are all strung together with hundreds of &'s and $'s.
It is truly bizarre and unmaintainable.

However, at some point my indignation stagnated into apathy. Sigh..

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to get an arbitrary sectional slice in 3D array ?
Next Topic: How to avoid the FOR loop when using TM_TEST?

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

Current Time: Wed Oct 08 17:35:22 PDT 2025

Total time taken to generate the page: 0.00570 seconds