24.2 LabTalk vs Origin C

The following table provides a comparison of LabTalk scripting versus Origin C programming:

Origin C LabTalk


No No need to compile. Easier to change and test simple codes.

Access to internal Origin objects

Yes, and includes far more control then LabTalk.

Yes, limited access.

Case sensitive? (commands and variables)



Calling Functions/Macros

Yes Standard rules of C language apply for calling functions.

Yes, limited support with substation notations.

Labtalk macros can be used like a command to invoke script.

Moreover, LabTalk has the ability to call specific sections of script (.OGS) files. This allows the passing of simple text arguments.

Mode of execution

Origin C code is organized into functions. Functions can be called from other Origin C functions in the standard way by passing arguments of different types. Functions accepting strings, doubles, and vectors (datasets) of strings and doubles and can be called from the Script window, from LabTalk scripts, from menu commands and toolbars buttons, as well as from buttons on various Origin windows (graphs, worksheets, etc.).

LabTalk scripts are usually organized by sections in .OGS script files. They can be called by simply typing the name of the OGS file. Also, LabTalk scripts can be typed directly into the Script window and executed from there. They can be associated with menu commands or toolbar buttons, or with buttons on various Origin windows (graphs, worksheets, etc.). Origin C Functions and X-Functions can be executed from LabTalk scripts.

Variable types

Yes, all standard C types are supported, as are pointers. Has built-in vector and matrix templates. Object-oriented access to Origin objects is supported. In addition, Tree and XML objects are also supported. All variables must be declared before being used.

Yes, scalars(double, int and const), string, StringArray, Tree and Range variables are supported for access to various Origin Objects.

Scope of Variables

All standard C/C++ scope concepts.

There are three classes of LabTalk variables:

Project variables

These are saved with the Origin (.OPJ ) Project File. They become unavailable as soon as the project is closed.

Session variables

Session variables are available in the current Origin session across projects. Thus, once a session variable has been defined, the variable exist until the Origin application is terminated or the variable is deleted.

Local variables

Local variables exist only within the current scope of the script.

Control structures

It supports all C-style control structures (if-else, switch, for, while, do-while, goto). It also supports foreach loops which provide a simple way to enumerate all members of a collection.

LabTalk supports C-like if-else and switch statements. It also supports C-like for-loop, as well as LabTalk-specific repeat and loop control structures.

Supports X-Function



X-Functions can be easily executed from Labtalk scripts. The new command window has extended support for accessing X-Functions, including auto complete.