2.3.2.7 X-Functions Introduction

The X-Function is a new feature, introduced in Origin 8, that provides a framework for building Origin tools. Most X-Functions can be accessed from LabTalk script to perform tasks like object manipulation or data analysis.

The general syntax for issuing an X-Function command from script is as follows, where square-brackets [ ] indicate optional statements:

xfname [-options] arg1:=value arg2:=value ... argN:=value;

Note that when running X-Functions, Origin uses a combined colon-equal symbol, ":=", to assign argument values. For example, to perform a simple linear fit, the fitlr X-Function is used:

// Data to be fit, Col(A) and Col(B) of the active worksheet,
// is assigned, using :=, to the input variable 'iy'
fitlr iy:=(col(a), col(b));

Also note that, while most X-Functions have optional arguments, it is often possible to call an X-Function with no arguments, in which case Origin uses default values and settings. For example, to create a new workbook, call the newbook X-Function:

newbook;

Since X-Functions are easy and useful to run, we will use many of them in the following script examples. Details on the options (including getting help, opening the dialog and creating auto-update output) and arguments for running X-Functions are discussed in the Calling X-Functions and Origin C Functions section.