Hi,
I hope this is appropriate for this forum.
I have a text file (test.txt) that contains information that I would like to parse into an IDL procedure. Each line of the text file is either a number or a string, which will be a variable in my IDL procedure. Therefore I want to read each line of the text file and store it as a separate variable. I think I have figured out how to do that.
openr, lun, 'test.txt', /get_lun
readf, lun, IDL_var#
'' '' ''
'' '' ''
free_lun, lun
The above code works if the lines of the text file are numbers. If the line is a string then I must first have: IDL_var#=''. This has worked so far because I have constructed my text file so that the IDL code knows which lines will be numbers, and which will be strings.
Here are my questions:
- Is there a better way to parse info from a text file into an IDL procedure?
- IMPORTANT: I currently have a variable that I would like to pass into the IDL procedure which will either be a string or a number. How can I make readf function blind to this? I won't be able to tell it in advance the type of variable.
Thank you for any help,
Mike