X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 Nov 2012 04:51 PM by  anon
printf within time interval
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
24 Nov 2012 04:51 PM
    I am fairly new to IDL and need some help with coding a specific task. I have a data file with time intervals that I read in from one text file (file A with i elements). For example, the time interval vectors are 'timestart' and 'timeend' and they each have the form FLOAT = Array[1, 78]. The times are in utc seconds. These two vectors form the time interval (i.e. timestart[i] and timeend[i] where timestart[i] Any help with exampel code related to this task would be greatly appreciated!

    Deleted User



    New Member


    Posts:
    New Member


    --
    29 Nov 2012 10:37 AM
    Hi Duncan, Well, the following is an example, though you will need to modify it so that it will print to a file instead of the console: pro forum_ex n=78 m=10000 tstart=findgen(78)*randomu(seed1,10000) tend =5*findgen(78)*randomu(seed2,10000) tstart_index=sort(tstart) tend_index=sort(tend) timestart=tstart[tstart_index] timeend=tend[tend_index] time=randomu(seed,10000) for i=0, m-1 do begin for j=0, n-1 do begin if time[i] LE timeend[j] and time[i] GE timestart[j] then begin print, '1' endif else begin print, '0' endelse endfor endfor end
    You are not authorized to post a reply.