2.5.1.8 From Import Wizard

The Import Wizard can be used to import ASCII, Binary or custom file formats (when using a custom program written in Origin C). The Wizard can save a filter in select locations and can include script that runs after the import occurs. Once created, the filter can be used to import data and automatically execute script. This same functionality applies when you drag a file from Explorer and drop onto Origin if Filter Manager has support for the file type.

For example,

  1. Start the Import Wizard.
  2. Browse to the Origin Samples\Spectroscopy folder and choose Peaks with Base.DAT.
  3. Click Add, then click OK.
  4. Click Next six times to get to the Save Filters page.
  5. Check Save Filter checkbox.
  6. Enter an appropriate Filter file name, such as Subtract Base and Find Peaks.
  7. Check Specify advanced filter options checkbox.
  8. Click Next.
  9. Paste the following into the text box:
  10. range raTime = 1;              // Get the Time column as a range
    range raAmp = 2;               // Get the Amp column as a range
    range raBase = 3;              // Get the Base column as a range
    page.xlcolname = 0;            // Turn off Spreadsheet Cell Notation firstly
    wks.addcol(Subtracted);        // Create a column called Subtracted
    range raSubtracted = 4;        // Get the Subtracted column as a range
    raSubtracted = raAmp - raBase; // Subtract Base from Amp
    pkFind iy:=(1,4);              // Find peaks in the Subtracted data
    range raPeaks = 5;             // Get the peak index column as a range
    for( idx = 1; idx <= raPeaks.GetSize() ; idx++ )
    {
        pkidx = raPeaks[idx];
        ty Peak found at $(raTime[pkidx]) with height of $(raSubtracted[pkidx]);
    }

    For the Spreadsheet Cell Notation in the workbook, please see FAQ-849 for more information.

  11. Click Finish.



This is what happens:

  • The filter is saved.
  • The import runs using this filter.
  • After the import, the script runs which creates the subtracted data and the pkFind function locates peak indices. Results are typed to the Script Window.