In article <3850F419.8382746A@leeds.ac.uk>,
mensar@leeds.ac.uk (Scott Reid) writes:
> I would like to thank everyone in the group for the help they have given
> me so far, particularly Liam Gumley. My latest problem is with
> XINTERANIMATE. The program runs, but I seem to be getting an error which
> says that 'only one animation at a time is allowed'. In the window I get
> the error :
>
> % Program caused arithmetic error: Floating divide by 0
>
> I believe the xinteranimate is loading the sequence 22 times. The
> program is :-
>
> pro OnOpen
>
> ; Get the Filename
> openr, 1, 'E:/Temp/batch.rvd'
> datas=fltarr(3,36,49,22)
> readf, 1, datas
> close, 1
> h=rebin(reform(datas[2,*,*,*]), 72, 98, 22)
> loadct, 3
> ; erase
> frames = fltarr(512, 512, 22)
> window, 1, TITLE='Bloodflow animation', xsize=512, ysize=512
> XINTERANIMATE, set=[512,512,22]
> for i=0, 21 do begin shade_surf, h[*,*,i], zrange=[-1,+1] &
> frames[*,*,i]=tvrd() & xinteranimate & end
>
> end
You need to specify two keywords to xinteranimate In the FOR loop that loads
the images into the animation - FRAMES and WINDOW. Here's a simple working
example that displays a running 40 point window of a 500 point data set:
pro anim_test
npts = 500
nshow = 40
nframes = npts - nshow + 1
pdat = sin (indgen(npts) / 5.)
window, 1, xsize = 500, ysize = 200
xinteranimate, set = [500, 200, nframes]
for i = 0, npts - nshow do begin
plot, pdat(i:i+nshow-1), title = strtrim (i,2) + ":" + strtrim (i+nshow-1,2)
xinteranimate, frame = i, window = 1
endfor
xinteranimate
end
Doug
|