[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading into arrays with order > 2



Hi Steven,

You are trying to read into a subscripted variable which is passed to
readf by value
and not by reference so when readf finishes all3MomData is unchanged.

this should work (assumimg that all3MomData matches the file format,
size+data type)

temp=reform(all3MomData[0,*,*])

for i=0, n_elements(names3Mom)-1 do begin
  openr, lun, names3Mom[i], /get_lun
  readf, lun, temp
  all3MomData[i,*,*]=temp
  free_lun, lun
endfor


good luck, 
	Ivan

Steven Riley wrote:
> 
> Assuming names3Mom is a 1D array of strings (of valid filenames) is there
> any reason why the following code will not read many files into a 3d array?
> 
> FOR I=0,1 DO BEGIN
>     close,1 & openr,1,names3Mom(I)
>     readf,1,all3MomData(I,*,*)
> END
> 
> I get no error messages, but when I look at my array it contains no data...?
> I'm quite sure the files being read contain data.  Is this some inherent
> problem with readf and arrays with order > 2?
> 
> Steven
> 
> --
> 
> Linacre College
> Oxford
> OX1 3JA
> 
> 01865 - (2)81229 (W)
> 01865 - 209295   (H)
> 
> www.linacre.ox.ac.uk/student_pages/steven_riley

-- 
Ivan Zimine
Dpt. of Radiology (MRI), Geneva University Hospitals
email: ivan.zimine@physics.unige.ch
tel. : (+41 22) 372 70 70