9.2.3 Importing Multiple Files into Workbooks Cloned from Active Workbook
Origin provides an easy way to "clone" import and analysis operations in the active workbook. This powerful feature allows you to process a group of files quickly with no more than a few button clicks.
This feature is implemented for most of Origin's supported import file types, e.g., ASCII, CSV, Excel, and will work with the older X-Function based routines (Data: Import From File) or the newer Data Connectors (Data: Connect to File). This tutorial makes use of the newer Connector technology but the methods are essentially the same for the older X-Function based import routines.
What you will learn
This tutorial will show you how to:
- Create a prototype workbook.
- Clone the workbook by importing and analyzing a group of similar data files.
Import Multiple ASCII Files into Cloned Workbooks
Create a Prototype Workbook
In this example we will import a file, make a scatter plot and perform a linear fit on the data, and embed the graph with fit results in our workbook.
- Start a new project. From the menu, choose Data: Connect to File: Text/CSV.
- Browse to the <Origin Installation Path>\Samples\Curve Fitting\ folder and select Sensor01.dat.
- Accept default settings in the CSV Import Options dialog, and click OK. The data file is connected to the worksheet.
- In the worksheet, click on the column B header to select the column, then click the Scatter button.
- Highlight column B (Sensor Output) and choose Plot: 2D: Scatter : Scatter to plot a scatter graph.
- Double-click on X axis to open the Axis dialog. Click on the Scale tab, press the CTRL key and choose both Horizontal and Vertical in the left panel. Set Rescale = Auto and click OK.
- Choose Analysis: Fitting: Linear Fit menu to open Linear Fit dialog. Set Recalculate = Auto (optional -- see tip below) and click OK to perform the fit. Answer No to the Reminder Message and click OK.
- Right-click in gray area to the right side of the Sensor01 worksheet and choose Add Graph:[Graph1]. The Scatter plot with linear fit curve will show as a floating graph on Sensor01.
In step 7., you were asked to set the Recalculate mode to Auto. Beginning with Origin 2018b, this step is not necessary as cloned imports automatically trigger recalculation. If you were using earlier versions of Origin with the ASCII import dialog box, you could invoke the same behavior by putting the following line of script into the Script after Each File Imported box (under the Scripts branch) of the ASCII dialog box.
run -p au;
Import Multiple Files and Perform Analysis by Cloning the Workbook
In this portion of the tutorial, we will "clone" all of the operations associated with Book1, including graphing and performing a linear fit, by importing more Sensor data files.
- With Book1 active, click the Clone Import button on the Import toolbar.
- Browse, again, to the Curve Fitting folder and use the SHIFT or CTRL keys to select files Sensor02.dat ... Sensor07.dat, click Add File(s) and then OK. All files are processed and the resulting graph and fit curve are embedded as a floating graph on each worksheet.