LoadWave merge delimiters
jdorsey
fileName = passed to function
lineNumber = first line in file containing only numbers or "NaN" (header is 2 lines above first data line)
lineNumber = first line in file containing only numbers or "NaN" (header is 2 lines above first data line)
LoadWave/J/M/U={0,0,1,0}/D/A=FogMontmp/E=0/K=0/V={"\t, "," $",0,1}/L={(lineNumber-2),lineNumber,0,0,0}/Q fileName
The problem seems to be that some of the data columns are delimited by both a tab AND a space. This results in blank columns in the loaded matrix and stops the right numbers lining up with the right headers. Ideally I'd like to be able to "merge" the tab and space characters where they appear. Is there a simple way to do this? Something like an option in the LoadWave command to ignore consecutive delimiters?
Thanks in advance.
If the file always uses the same column names then I recommend using the /B flag to set the names and remove the /W flag so they are not read from the file.
If that does not work then you will have to create a cleaned up version of the file. For an example see http://www.igorexchange.com/node/856.
Another approach would be to read the wave names from the file using FReadLine, then use /B to set the wave names. Here is a snippet that might help you: http://www.igorexchange.com/node/908
April 30, 2014 at 08:51 am - Permalink
/V={delimsStr, skipCharsStr, numConversionFlags, loadFlags }
My skipCharsStr conatins
" $"
, so LoadWave should be ignoring the spaces before numeric vlues should it not? It seems not to behave as suggested...April 30, 2014 at 09:10 am - Permalink
Thanks for the pointers.
April 30, 2014 at 09:36 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 30, 2014 at 10:04 am - Permalink
April 30, 2014 at 10:54 am - Permalink
But if the format can be changed, then that suggests that an approach for just a few files might be to just manually edit the header lines on files created before you change the format.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 30, 2014 at 12:23 pm - Permalink