On Wednesday, June 3, 2015 at 5:39:15 PM UTC+2, g.na...@gmail.com wrote:
>> "OPENW: Filename argument must be a scalar string: FILE."
>> you should check if your variable file is a string or a scalar.
>
> I used
> help, file
> to check whether is a string or a scalar and I got the following
>
> FILE UNDEFINED = <Undefined>
> OPENW: Filename argument must be a scalar string: FILE.
>
> I will share my code because maybe I did a mistake somewhere else and I am not able to find it. I have the following procedure. (Image,VX,VY are 3D arrays.)
>
>
> PRO vectors_overlaid, Image, VX, VY, name
>
> dims_i_need = Size(Dindgen(20,20), /Dimensions)
>
> pos_x = Rebin(Findgen(dims_i_need[0]), dims_i_need[0], dims_i_need[1])
> pos_y = Rebin(Reform(Findgen(dims_i_need[1]), 1, dims_i_need[1]), dims_i_need[0], dims_i_need[1])
>
> for i=0L, n-1 do begin
> cgDisplay, 500, 550
> Image = BYTSCL(Image, min=0.,max=160.)
> cgimage,Reform(Image[i,*,*])
> cgDrawVectors, REFORM(VX[i,*,*]), REFORM(VY[i,*,*]), pos_x, pos_y,VECCOLORS='yellow', /ORDERED, overplot = 1
> write_gif,file, Reform(Image[i,*,*]), /multiple
> endfor
>
> write_gif, file, /close
> END
>
> Then I called the vectors_overlaid in my main program like this
>
> vectors_overlaid, Image, VX,VY, 'C:\Users\Desktop\Vectors('+string(i,format='(i3.3)')+','+st ring(level)+','+strtrim(iter)+')'.gif'
>
> Why the file is undefined?
Ok, this is something you should be able to solve by looking at what the error messages tell you and what the help, file told you (file is undefined!).
In your procedure declaration you use:
PRO vectors_overlaid, Image, VX, VY, name
These variable names have to be used in the procedure. This means that when you call:
vectors_overlaid, Image, VX,VY, 'C:\Users\Desktop\Vectors('+string(i,format='(i3.3)')+','+st ring(level)+','+strtrim(iter)+')'.gif'
the variable "name" assumes the value 'C:\Users\Desktop\Vectors('+string(i,format='(i3.3)')+','+st ring(level)+','+strtrim(iter)+')'.gif'
so in *all* your write_gif commands you should substitute "file" with "name".
That should bring you a step further.
Cheers,
Helder
|