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

Home » Public Forums » archive » Re: IDL 8.0 questions
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: IDL 8.0 questions [message #71824 is a reply to message #71822] Sat, 24 July 2010 16:24 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jul 24, 1:18 pm, Mike Potter <m...@orionsound.com> wrote:
> 1)  I'm trying out the new "foreach" capability.  The top loop, below,
> works, the bottom one does not.
>
> for i=0,nf-1 do begin
>     qfile = file_names[i]
>     image = readfits( qfile )
>     sky,image,sky,sky_sig,/silent
>     q = dialog_message( "Sky = "+string(sky)+"  Sigma =
> "+string(sky_sig) ,/information )
> endfor
>
> foreach qfile, file_names do begin
>     image = readfits( qfile )
>     sky,image,sky_mod,sky_sig,/silent
>     q = dialog_message( "Sky = "+string(sky_mod)+"  Sigma =
> "+string(sky_sig) ,/information )
> endforeach
>
> After running the bottom loop, the first time readfits is called it
> crashes and the input "qfile" has been changed and either contains two
> characters equal to the final two characters of what qfile was on
> input, or it returns a short string of garbage characters.
> (file_names is a string array of filenames returned by
> dialog_pickfile).

I do not see why the second loop should not work the same as the
first. I can only suggest to check the values in file_names before
running each loop, or during the foreach loop, to make sure they are
actually the same.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Writing in IDL at the same line in the screen
Next Topic: Extract pixel values from HDF-EOS file

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

Current Time: Sun Oct 12 10:04:41 PDT 2025

Total time taken to generate the page: 1.03799 seconds