9.1.5 Post Processing with Import Filter

Summary

The Import Wizard allows defining a custom filter to import ASCII and simple binary files. The filter can then be reused with similar data files once created. The filter mechanism also allows including LabTalk script lines that will then be run at the end of the import. This capability allows user to add post-processing script code to the filter.

Minimum Origin Version Required: Origin 8.0 SR6

What you will learn

  • How to add post processing script to existing import wizard filter

Steps

  1. Start a new workbook by clicking the New Workbook button New Workbook.png on the Standard toolbar.
  2. Click the Import Wizard button Import Wizard.png on the Standard toolbar to open the wizard.
  3. In the Data Source group, click the Browse.png button to the right of File and navigate to and add the file Samples\Import and Export\S15-125-03.dat.
  4. A suitable filter for importing this file already exists in the data folder. Click the Next button to proceed thru all the pages of the wizard till you get to the Save Filters page.
  5. On this page, check the Save Filter checkbox and select the option of In the User Files folder. Then specify the filter name as fil_01 in the Filter file name(.OIF extension will be appended) area.
  6. Check the Specify advanced filter options checkbox and then click Next. This will bring you to the Advanced Options page.
  1. On this page, copy and paste the following lines in the Script after Each File Imported edit box:
    nlbegin iy:=(1,4) func:=gauss;
    nlfit;
    nlend output:=1 autoupdate:=au_auto;
  2. Click Finish. This will save the filter along with these added lines of script, and the file will be imported and the script will run. The workbook will then have three sheets, which will include the custom report sheet and the fitted curve sheet, which are results of Gauss function fit to column 4 of the imported data.
  3. Start a new project and open import wizard again and add all three files S15_125_03.dat, S21-235-07, S32-014-04 in the file open dialog.
  4. Under Import Filter, check List filters applicable to both Data Type and file name checkbox and select Select User File Folder:fil_01 from the Import Filters for current Data Type drop-down list.
  5. Under Target Window, select Start New Books from the Import mode drop-down list then click Finish. Your modified filter will be used and after each file is imported, the 4th column will be fit with the Gauss function.