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

Home » Public Forums » archive » Re: Having problems with the modulo operator
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: Having problems with the modulo operator [message #33089] Thu, 05 December 2002 00:41
rmoss4 is currently offline  rmoss4
Messages: 21
Registered: October 2002
Junior Member
Note that ( 0 mod 4 ) equals 0 always, and since you have i starting at
1, your condition (as you wrote it) will never be satisfied.

I think what you want is

if ( i MOD 4 ) eq 0 then

This will execute the iff statement every 4th time.

Robert Moss, PhD
rmoss4@houston.rr.com


Nate Doyle wrote:
> Hi everyone,
> I'm having an annoying problem. My program is skipping over a loop
> that I have. Specifically it's skipping over the if bit of my code.
> I pasted what I have at the bottom of the message. The while runs
> just fine but when I get down to the eleventh line of the code it just
> keeps on running. What am I doing wrong? I've tried the 0 mod 4 bit
> with and without parens.
>
> Thanks in advance
>
> Nate
>
> i=1
> new=replicate(data_comp_struct,200)
> line=' '
> linearr=[' ']
> while not EOF(lun) do begin
> readf,lun,line
> line=strcompress(line)
> line=strmid(line,strpos(line,'{ ')+1,strlen(line)-1)
> linearr=[linearr,strsplit(line,/extract)]
> if linearr[1] eq '{' then linearr=linearr[2:*]
> if i eq (0 mod 4) then begin
> for j=0,n_elements(linearr)-1 do begin
> linearr=linearr[1:*]
> exp_time_correct,linearr
> data_comp_struct.(j)=linearr[j]
> new[i/4]=data_comp_struct
> print,new[0]
> data_comp_struct=reset
> linearr=[' ']
> endfor
> end
> i=i+1
> endwhile
[Message index]
 
Read Message
Previous Topic: builtin simplex?
Next Topic: Re: IDL/Linux color table problems

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

Current Time: Fri Oct 10 15:29:45 PDT 2025

Total time taken to generate the page: 0.23983 seconds