The function below imports the 2nd (X) and 3rd (Y) columns from the first file but only the Y column from the rest. Add it to your workspace as described here and execute from the script window... import_test dConstant where dConstant is the constant for the X column.
void import_test(double dConstant = 1.0)
{
StringArray sa;
int iCount = GetMultiOpenBox(sa, FDLOG_ASCII, NULL, NULL, NULL, false);
if( !iCount ) return;
Worksheet wks;
wks.Create(); // create wks
ASCIMP ascimp; // ASCII options
wks.GetASCIMP(ascimp);
ascimp.iPartial = ASCIMP_PARTIAL_YES;
ascimp.iPartialC2 = 2; // stop at col 2;
ascimp.iMode = 1; // import as New Wks(0), New Columns (1), New Rows (2)
char chPath[MAX_PATH];
for(int ii=0; ii<iCount; ii++)
{
ascimp.iPartialC1 = ii==0 ? 1 : 2; // start at col ii
wks.SetASCIMP(ascimp);
wks.ImportASCII(sa[ii], ascimp);
wks.Columns(ii + 1).SetLabel(GetFileName(sa[ii]));
}
wks.ShowLabels();
wks.Columns(0).SetType(OKDATAOBJ_DESIGNATION_X); // set 1st col as X
wks.Sort(SORT_DESCENDING);
Dataset ds(wks,0);
ds = dConstant / ds;
GraphPage gp;
gp.Create();
gp.Layers(0).AddPlot(wks); // plot all Y cols
gp.LT_execute("legend");
}
quote:
Another question is that I cannot find how to select by default 'import each files as' "New Columns" when using the 'Import Multiple Ascii' menu.