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

Home » Public Forums » archive » Re: how to do a loop in idl using multi-commmand?
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: how to do a loop in idl using multi-commmand? [message #43537 is a reply to message #43536] Fri, 15 April 2005 10:15 Go to previous message
mperrin+news is currently offline  mperrin+news
Messages: 81
Registered: May 2001
Member
lixiaoyao <lixiaoyao5880@yahoo.com> wrote:
> I can run this in my idl,who know how to solve it?
> nH2=findgen(10001)*10.0+0.1
> ratio=make_array(10001)
> for i=0,10000 do
> x=2*nH2[i]
> y=x*nH2[i]
> ratio[i]=x/y
> openw,1,'file'
> printf,1,ratio
> close,1
> it seems to show you can not do multicommand in do loop.

You need to add "begin" and "end" around the commands you want to loop.

nH2=findgen(10001)*10.0+0.1
ratio=make_array(10001)
for i=0,10000 do begin
x=2*nH2[i]
y=x*nH2[i]
ratio[i]=x/y
end
openw,1,'file'
printf,1,ratio
close,1
[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: Nice ways to compile
Next Topic: .compile vs .run

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

Current Time: Sat Nov 29 04:48:23 PST 2025

Total time taken to generate the page: 1.27958 seconds