On Monday, 29 June 2015 11:41:32 UTC-4, Priyadarsini Sivaraj wrote:
> Hello Everyone..
>
> I have 15 simple ASCII files, which have to be read and the details of it are to be stored in a structure called ROI. The fields of the structure are,
> NumROI-vector
> Name-String
> Color- 3 element vector
> NumPoints-integer
> Records-integer
> Points- Two dimensional vector.
>
> I tried reading them all in a loop by using,
>
> FOR i=1,15 DO BEGIN
> filename=[str,STRTRIM(i,2),ext]
> file=[filelocation,filename]
> Trial_ROI_Read,file
>
> In the procedure, I tried doing this,
>
> PRO Trial_ROI_Read, file
>
>
> p =MAKE_ARRAY(5,198,value=1)
> ROIs = CREATE_STRUCT('NumROI',[1],'Name','a','Color','1,1,1','NumPo ints',[1],'Records',[1],'Points',p[*,*])
> OPENR, lun1,file, /GET_LUN
> header = STRARR(12)
> READF, lun1, header
> ROIs.NumROI=STRMID(header(3),18)
> ROIs.Name=STRMID(header(9),12)
> ROIs.NumPoints=STRMID(header(11),13)
> ROIs.Color=STRMID(header(10),17)
>
>
> points = [id , x, y, lat, lon]
> WHILE ~EOF(lun1) DO BEGIN
>
> READF, lun1, id, x, y, lat, lon
> pt = [id,x,y,lat,lon]
> ;print, pt
> points = [points , pt]
>
> ENDWHILE
>
> points= REFORM(points , [ 5 , 198 ])
>
> But I am not able to open the file and the following error pops up:
> OPENR: Expression must be a scalar or 1 element array in this context: FILENAME.
>
> Is there any efficient way to do this..??Please do help me out..I am not well versed with IDL.
Sry..The subject is OPENR: Expression must be a scalar or 1 element array in this context: FILENAME.
|