;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Name: ; readmem.pro ; ; Purpose: ; This program opens and reads datasets saved to file using the writedata.pro by Thomas Boerner. ; It is just a slight modification of the readdata.pro (by Thomas Boerner), which returns also ; some informations about the opened dataset as an optional parameter. ; ; Author: ; Vito Alberga ; ; Date: ; September 1999 ; ; Calling sequence: ; readmem, data, datainfo, title = TITLE ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; pro readmem, data, datainfo, title = TITLE path_open = 'd:\alberga\idl_sar\data\' ; Location of the .eps file to be opened. file = dialog_pickfile(/read, path = path_open, filter='*.dat', title = TITLE) get_lun, lu openr, lu, file datainfosize = 0l readu, lu, datainfosize ; Read the first value of the file, a long integer, which tells how many ; numbers (long integer) have to be read to know all the information ; about the matrix to be opened. print, datainfosize datainfo = lonarr(datainfosize) ; Define a long integer vector with as many elements as those ; indicated by datainfosize. readu, lu, datainfo ; Restart reading the file from the point where it stopped after ; the first readu command. datatype = datainfo(datainfo(0)+1) print, datainfo(0), datatype print, datainfo case datatype of 1: data = make_array(dimension=datainfo(1:datainfo(0)),/byte) 2: data = make_array(dimension=datainfo(1:datainfo(0)),/fix) ;integer 3: data = make_array(dimension=datainfo(1:datainfo(0)),/long) 4: data = make_array(dimension=datainfo(1:datainfo(0)),/float) 5: data = make_array(dimension=datainfo(1:datainfo(0)),/double) 6: data = make_array(dimension=datainfo(1:datainfo(0)),/complex) 9: data = make_array(dimension=datainfo(1:datainfo(0)),/dcomplex) else: begin print, 'wrong data type ...' return end endcase readu, lu, data ; Restart reading the file (in the format specified by 'data') from ; the point where it stopped after the command: 'readu, lu, datainfo'. help, data free_lun, lu return end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;