I haven't used pv-wave for very long, so bear with me if the answer
to my questions seem obvious. In a procedure I am writing, I want to
be able to extra certain data from a .txt file and store that data
into specific variables that I have already in my procedure. The data
within the .txt files are produced through pv-wave so it will always
be the same formatting - so Step1: find the file ( I know how to do
Step2: user inputs a number (in my case this is
called the shot number)
Step3: check if that number is there
Step4:retrieve the data (i would only need the
lines below that shot and above the next shot)
Step5:split up the data into specific variables
(I can manage that)
The format of the .txt file looks something like this
h12 54 69 72
h13 47 85 92
Any ideas at all? Sorry if this is all sounds convoluted.
I don't know about pv-wave, but below is the IDL code I would use and I'm not an expert... I just try to make things work. Please notice:
- that the is no control that the inserted number is in fact a number. In case it is not, it will either complain or go through the procedure without getting any hit.
- if you're trying to get the last shot number and the file ends on the last line (or on the line just after), the last input line will not be found. Add to your file a line with something like "end" to be on the safe side
- if the number of lines for each shot is high, then the code line MyInputData = [MyInputData,Str] will become very inefficient. If you know how many lines you will expect it is best to make the array beforehand, otherwise you might have to loop through and count the lines...