X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 26 Jan 2011 03:28 AM by  anon
Reading and saving a file
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
26 Jan 2011 03:28 AM
    Hi all, I need to read and save a file using IDL, but my code is reading and saving only the first line. Please, see my code: PRO READ_FILE OpenR, lun, 'C:\Documents and Settings\Web\IDLWorkspace\Projeto_Estudo\dados.dat', /Get_lun file = '' ReadF, lun, file SAVE, FILENAME=('C:\Documents and Settings\Web\IDLWorkspace\Projeto_Estudo\teste1.dat') ;print,file END

    Deleted User



    New Member


    Posts:
    New Member


    --
    27 Jan 2011 11:45 AM
    You've almost got it correct. To read a file into IDL in this way try this: OpenR, lun, 'testfile.txt', /Get_lun nlines = file_lines('testfile.txt') file = strarr(nlines) ReadF, lun, file help, file print, transpose(file) The key is to get the number of lines in the file, create a string array with that many elements, and then read it in with READF. Also, is the SAVE command intended to save the "file" variable to an IDL data save file? If so you will need to supply the variable name or use the /ALL keyword. -Josh ITTVIS

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jan 2011 03:54 AM
    Hi, I need to read a file file.sav and file1.cnj, then i need restore and to get the structures modelo.imag, conjugado.imag. And to save in the new file - data.dat(line 16). I don't know how to take these structures(modelo.imag, conjugado.imag) and save in this file data.dat CAn you help me.?? My code: http://pastebin.com/GRmNtags
    You are not authorized to post a reply.