Hinweis:Dieser Abschnitt ist nur in englischer Sprache verfügbar. Wir bitten um Ihr Verständnis.
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,
- Start the Import Wizard.
- Browse to the Origin Samples\Spectroscopy folder and choose Peaks with Base.DAT.
- Click Add, then click OK.
- Click Next six times to get to the Save Filters page.
- Check Save Filter checkbox.
- Enter an appropriate Filter file name, such as Subtract Base and Find Peaks.
- Check Specify advanced filter options checkbox.
- Click Next.
- Paste the following into the text box:
- Click Finish.
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. |
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.