2.17 FAQ-428 How to run LabTalk script after import?

Last Update: 11/18/2024


There are several options for running LabTalk script after import to do post-processing of the data (calculations, formatting, analysis, plotting):

Note: The execution of the post import script does not break the connection to the source data.

DialogOtherOptionsPostImportLabTalkScript.png
Script WorksheetProperties.png


Note 1:This operation is not applicable to Famos, MDF and pClamp file formats.
Note 2: You can check the Open XF Dialog box under the General Import Setting section in the iwfilter dialog box and open the corresponding import dialog when importing data.

Post Import Script Examples:

// Specify column width
wks.col1.width = 5;
wks.col2.width = 20;
wks.col3.width = 8;
// Designating X, Y, and Y Error columns
wks.col1.type = 5; // Designate col(A) to contain data labels
wks.col2.type = 4; // Designate col(B) as X data
wks.col3.type = 1; // Col(C) as Y data
wks.col4.type = 3; // Col(D) as YErr
// Name the workbook with the current date
string theDate = date2str($(today()), "MM-dd-yyyy")$;
page.longname$ = theDate$;
// These are just two possible approaches to calculating and recording column means in the metadata area
// Method 1
wks.userParam1 = 1; // Set visibility to 1 (0 = not visible)
wks.userParam1$ = "ColumnMean";
col(A)[ColumnMean]$ = $(mean(col(A)));
col(B)[ColumnMean]$ = $(mean(col(B)));

//Method 2 
wks.userparam(++Mean);
loop(ii,1,wks.ncols) { wcol(ii)[Mean]$="=Mean(this)"; } // This loops through all columns}

Keywords:LabTalk script, Post-Processing, Import Data, Import Filter, iwfilter, Worksheet Script, Worksheet Properties, Batch Processing, Post Import