Many of Origin's analysis tools and other data processing tools have been implemented using X-Functions. The Command Window provides a convenient way to run these functions.
Another important use for the Command Window is to send LabTalk script commands to Origin. Script commands can range from simple math and data operations, to user-created X-Functions or Origin C functions.
Minimum Origin Version Required: Origin 8.0 SR6
This tutorial will introduce you to the Command Window and show you how to:
The Command Window consists of two panels: the Command Panel and History Panel:
The Command Window is normally located at the bottom right corner of the screen, but if it is not visible, you can access it by pressing Alt+3 or by selecting View: Command Window.
When typing in the Command Panel, the Auto Complete support allows you to choose among X-Function script commands and OGS files in the current working folder. The command and OGS file name will be respectively preceded by Xf and LT. You can move up and down the list using the arrow keys; pressing Enter selects the item. After your selection, press the space bar and the Auto Complete now shows you the available options for the command.
The Command Window can be used as a calculator or to access any of Origin's mathematical functions. See the examples below.
One of the more basic uses for the Command Window is as an interface to perform simple calculations. For example, type the following:
2+2=
Press ENTER. Origin returns
2+2=4
If you are typing multiple lines of scripts, first edit it in Code Builder (View:Code Builder) or any text editor, such as Windows Notepad, ending each line with a semi-colon, and then Copy + Paste the script in the Command Window, and press ENTER to execute. For example, paste the following script in the Command Window and ENTER:
sum = 0; loop(ii, 1, 10) { sum += ii; } sum = ;
Origin returns:
SUM=55
Any mathematical function, built-in as well as user-created, can be executed from the Command Window. For example, type:
ln(10) =
Origin returns natural logarithm value of 10.
You can also use the Script Window to read and write worksheet values, or to perform math operations on datasets.

cell(1,2)=
CELL(1,2)=6
You can also use the column name and row number to reference cell values.
col(B)[1]=
COL(B)[1]=6
| Notes: In addition to using the column name, you can also use the dataset name. In LabTalk, the syntax for naming datasets is worksheetName_columnName. So, For example, Book1_A[1]= would return the first element of column A in worksheet Data1. Also, if the worksheet that you are referencing is the active window, you can use the LabTalk string variable %H, in place of the worksheet name. For example, %H_A[1]. |
To subtract the value in row 1 of column A, from all the values in column B…
col(B)=col(B)-col(A)[1]

Let's use what we have learned about executing multiple lines of script in the Script window. We will multiply every value in a column of data by some constant b.
b=3;
col(A)=col(A)*b;
Your worksheet now reads:

| Notes: The following C notation is also supported:
b=3; col(A)*=b; |
You can also use linear interpolation or extrapolation on a specified X dataset to find the corresponding interpolated or extrapolated value in a Y dataset. This requires using a new notation with parentheses ( ) instead of brackets [ ].
In this example, book1_b is a Y dataset and (4) is a value in an X dataset (book1_a) for which you want to find a corresponding, interpolated Y value.
book1_b(4) =
BOOK1_B(4)=5.333333

This is a line plot of our simple worksheet data. You can see that our interpolated Y value – the one corresponding to X = 4 – is 5.333333.
range a = [Book1]Sheet1!Col(A); range b = [Book2]Sheet1!Col(A); b = sin(a);
Origin 8 provides a large collection of X-Functions for performing a wide variety of data processing tasks. Of this collection, many of the X-Functions are accessible from LabTalk script. The functions accessible from script provide a powerful environment for users to create custom script code for their routine tasks.
X-Functions that are accessible from script can be listed in the Command Window, and you can also obtain help on the command syntax as well as make use of auto completion of commands for such functions.
X-Functions accept data range string or range variable for specifying source and destination data for the operation. For example, the smooth X-Function under signal processing can be accessed from the Command Window as follows:
smooth iy:=Col(2) method:=1 npts:=200When you press ENTER, the result will append to the source worksheet.

help smoothto open the corresponding Help.