Skip loaded columns
Cory K
Wed, 11/19/2008 - 04:50 pm
LoadWave
Are there any flags I can add to skip columns.
For example if I have columns 0,1,2,3,4,5,6,7,8
But I only want to read in 0,1,4,5,6
What flag would I add?
I realize you have come a long way on your own. I do however suggest that you look at the loader panel and associated tab-delimited file loader that I have written. A picture of the panel is here. In addition to the many features of the input panel itself, the tab delimited loader allows you to select to read only certain columns from a tab-delimited file by typing an easily understood notation into the User Data input area (in this case, [1,2,5-7]).
Download and install the package here as a start.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
November 19, 2008 at 05:22 pm - Permalink
November 20, 2008 at 08:40 am - Permalink
To do it programmatically, you can use the LoadWave /B flag. For example:
columnInfoStr += "N=Column0;"
columnInfoStr += "N=Column1;"
columnInfoStr += "C=2,N='_skip_';" // Skip Column2 and column3
columnInfoStr += "N=Column4;"
columnInfoStr += "N=Column5;"
columnInfoStr += "N=Column6;"
columnInfoStr += "C=2,N='_skip_';" // Skip Column7 and column8
This is a rather complex flag so read the LoadWave /B documentation carefully.
November 20, 2008 at 09:44 pm - Permalink
June 20, 2018 at 11:17 am - Permalink
Variable numColumns // e.g., 329
String columnInfoStr = ""
Variable columnIndex // Zero-based
for(columnIndex=0; columnIndex<numColumns; columnIndex+=1)
String columnName = "_skip_"
switch(columnIndex)
case 3:
columnName = "Column3"
break
case 7:
columnName = "Column7"
break
endswitch
String columnInfoForThisColumn = "N='" + columnName + "';" // e.g., "N='_skip_';" or "N='Column3';"
columnInfoStr += columnInfoForThisColumn
endfor
return columnInfoStr
End
Function Demo()
Variable numColumns = 10
String columnInfoStr = GetColumnInfoStr(numColumns)
Print columnInfoStr
// LoadWave /B=columnInfoStr <other flags> ...
End
June 20, 2018 at 12:06 pm - Permalink