Loading multiple waves with different firstline values
noxidxela
Fri, 03/02/2018 - 06:26 pm
Hi. I have a function that loads in waves from multiple text files using LoadWave. Most of the files have a header of a set length so I use the /L flag and set the location of the first line of data. However in a few of the files, the header is a couple of lines longer, this causes LoadWave to start loading the header itself instead of the desired data. The end of the header has a clear deliminator, Is there any way to read the line location of this delimitation so I can make the "first line" variable?
Thanks!
Otherwise here is a code snippet that shows how to find the first line: http://www.igorexchange.com/node/4856
March 2, 2018 at 09:00 pm - Permalink
FReadLine
), count the lines and hand it to the /L flag as a parameter.HJ
March 6, 2018 at 12:26 pm - Permalink
Thanks, I ended up going with your suggestion and writing a little function to find the start line for the L flag.
string path
variable refn,i
string readstring
i=0
open/r refn path
do
FReadline refn , readstring
i+=1
while (strsearch (readstring, "*HeaderEnd*",0,2)<0)
return i
end
March 13, 2018 at 05:30 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
March 14, 2018 at 09:47 am - Permalink
string path
Grep /Q/E="\*HeaderEnd\*"/Z path
return V_startParagraph
end
March 15, 2018 at 11:55 am - Permalink
March 15, 2018 at 08:37 am - Permalink
Oops, actually, I forgot to escape the asterisks in the regexp. The asterisks were part of the end-of-header mark in the example given. Edited to correct. Thanks, Thomas.
March 15, 2018 at 12:00 pm - Permalink