Re: Syntax Error Confusion [message #55487] |
Fri, 24 August 2007 11:16  |
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  |
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  |
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
------------------------------------------------------------ --------------
|
|
|