Batch processing is one powerful feature of Origin that perform repeated analysis tasks in batch. Normally batch process only accepts data imported into worksheet. Then the question is can we run batch process on matrices as well? It would be time-saving if we can perform surface fitting on the following matrices all at once. Starting from Origin 2018b, matrix can be added into workbook as a worksheet, which makes it possible to perform batch process on matrices. This blog will show step by step how to do it. Please download the zip file for data files and the finished analysis template.
1. First we need create the analysis template for batch processing. Lauch Origin, click New Matrix button in toolbar to create a new matrix. Then click Import Single ASCII button from tool bar, select GaussData1.dat inside the folder. Click OK to finish importing. (see below) This matrix shows a peak at upper left. we next fit this peak with 2D Gauss function.
2. With the matrix activated, select from menu Analysis:Nonlinear Matrix Fit. In the NLFit dialog, set Gauss2D as the fitting function. Click Fit to perform the fitting.
3. Once the fitting is done, two matrix sheets containing the data of fitted surface and residuals are added to the initial matrix, we ignore these for now. In addition, a report worksheet FitMatrix1 is also generated. We will create our analysis template from this worksheet.
4. This step is importtant. Make sure the first matrix sheet (GaussData1) is active, go to the workbook, right click on the sheet label and select Add Matrix as Sheet:[GaussData1]. The matrix is now added as a worksheet with name GaussData1 into the workbook. We can drag its sheet label to move it in front of the FitMatrix sheet because it’s actually the input of the analysis.
5. The following are routine steps to create analysis template with a summary sheet, let’s finish it. Right click on FitMatrix1 sheet label and select Add to add a new sheet at the end. Double click the new sheet label and change its name to Result. Go back to FitMatrix1 worksheet, go to the Summary branch , copy the two entire label rows, go to Result sheet, right click on the first cell to the right of Long Name, select Paste to past the label rows over. Go back to FitMatrix1 worksheet, select the entire row of the data part of Summary branch, go to Result sheet, right click on A1 cell, select Paste Link to copy over the data as link.
6. The Result worksheet should look like below. Now right click on the title bar of the workbook, select Save As Analysis Template, save it with name BatchMatrixFit.ogwu.
7. To perform batch processing, select from menu File:Batch Processing… Set Analysis Template as the created template. Select the six data files in the folder. Set Dataset Identifier to File Name, set Data sheet(s) to GaussData1, set Result Sheet to Result. Click OK.
8. After batch processing, a summary results worksheet is generated. You can select any row and click the Open Book(s) button to check the fitting detail of each dataset.