OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis
  Company    Products    Support    Solutions    Purchase    Downloads   
 


Products :  Origin :  Programming

 

Programming in Origin

Origin provides a broad range of tools for importing, analyzing, graphing, presenting, and exporting data. As you gain familiarity with Origin, you may want to create custom programs in Origin that make use of these abilities. To facilitate your customization, Origin includes two built-in programming languages: Origin C and a scripting language called LabTalk™. Further, Origin offers a structured programming environment that provides a framework for building Origin tools called X-Functions. Origin is also an Automation Server for users of VB, C++, C# and LabVIEW™.

Origin's Code Builder
Code Builder

Automation Server

Origin functions as an automation server for client applications, such as Microsoft® Excel®, Microsoft® Visual Basic®, and National Instruments™ LabVIEW™, that support Component Object Model (COM).

Data can be passed to Origin from the client application, graphed, analyzed, and the result exported or brought back into your application without ever seeing Origin. When paired with Origin's capability to create Analysis Templates™, Origin's Automation Server creates a powerful way to analyze data acquired from an instrument or sensor, for example.

Origin C

Origin C is a powerful programming language that supports ANSI C plus some C++ features, including support for string, complex, vector and matrix data types, as well as internal Origin objects like worksheets and graphs.

Origin C is ideal for creating data processing and analysis routines, as well as for developing complicated algorithms. View examples and the Origin C help.

Programs written in Origin C are compiled and linked to internal Origin objects that are executed during run time. Although not as fast as machine executable code produced by true compilers, a significant improvement in speed can be seen over previous programming options in Origin. In fact, certain tasks, such as computational loops and curve fitting with user-defined fitting functions, execute as much as 20 times faster than if they were executed using LabTalk™, Origin's built-in scripting language.

For the ultimate in speed, Origin C can be linked to (i.e. it can call exported functions from) external dynamic link libraries (DLLs) that have been built using third party native compilers, such as Microsoft® Visual C++. Origin C's link with the DLL enables the passing of pointers from Origin's data structures directly to external DLLs, with little overhead or unnecessary copying of data as would normally be the case when programming in Microsoft® Visual Basic.

Code Builder, Origin C's integrated development environment, provides users with a familiar programming language interface that includes color-coded editing and modern debugging capabilities.

Common customizations that can be achieved using Origin C include:

  • Added Functionality: Create new importing, analysis, graphing, and exporting routines.

  • Automation/Batch Processes: Create a routine that automatically performs the tasks you do in Origin.

  • Simulations: Perform simulations with live feedback in Origin. For instance, you might want to execute a Monte Carlo Simulation that dynamically updates a graph.

  • User-defined Fitting Functions: Create complex user-defined curve fitting functions using Origin's Advanced Fitting Tool's direct link to Code Builder. This allows you to create and debug fitting functions quickly and easily.

Read further about Origin C programming.

LabTalk

LabTalk is a high-level, full-featured programming language which has access to most of Origin's operation. Its syntax and structure are similar, but not identical to C. LabTalk incorporates DOS-style commands with option switches and arguments, as well as object properties and methods comparable to those in Visual Basic.

LabTalk is ideal for performing simple tasks in Origin, as well as for writing and executing quick scripts. You can even create custom LabTalk utilities that run by clicking on a toolbar button.

Origin C and LabTalk

In addition to the power of Origin C and the simplicity of LabTalk, the two programming languages are tightly connected. This connection makes LabTalk commands and variables accessible to Origin C functions. It even allows you to call Origin C functions from your LabTalk code! This makes the ability to create customizations that are callable from toolbar buttons very useful. Origin's built-in cross communication between its two programming languages gives you the best of both worlds and makes it a robust and powerful programming platform for graphing and data analysis.

X-Functions

Base on these two tightly connected programming languages, Origin 8.1 introduced a new mechanism for programming, X-Function. It provides a framework for building tools in Origin. Most of the analysis tools and other data processing tools in Origin 8.1 have been implemented using this new framework.

The X-Function is essentially an XML file saved on disk, which can be loaded in Origin as a special type of function. The core part of the XML file is an Origin C function that performs the computational part of desired operation. Most X-Functions are accessible from the Origin GUI, as well as from the LabTalk script programming environment. One key benefit of X-Functions is that an X-Function can be invoked as a dialog, and the dialog is auto constructed by Origin. The user can thus focus on the actual data processing code and not have to worry about writing code for the user interface.

For creating custom tools that require advanced data processing, or numerical computation, or handling large volumes of data, it is therefore very beneficial to write the custom routine as an X-Function. Once the X-Function has been created, it can be easily accessed from the GUI, and from LabTalk script.

Go to the NAG web site

NAG® Software Partner
Origin 8.1 includes the entire Mark VII Library of numerical computational routines from Numerical Algorithms Group, Inc. (NAG®). These routines offer a large selection of time-tested numerical algorithms, such as Statistics, Fourier Transforms, Linear Algebra, Regression, Multivariate Analysis including Principal Component Analysis, and more.

All NAG function calls are accessible from Origin C to allow you to develop applications that require advanced numerical computation.

Other Resources
To learn more about how you can programmatically customize Origin, browse the pages offered in the Programming area by clicking on the desired link in the page. Or, review the Origin sample projects and associated programming source files that are installed in your Origin\Samples\Origin C Examples\ subfolders.