Back to Top
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      

Programming

As you gain experience with Origin, you may want to access Origin features programmatically, add your own custom routines and tools, or communicate with Origin from other applications.

LabTalk

LabTalk is a full-fledged scripting language native to Origin. Almost any task performed in Origin's graphical user interface can also be performed using LabTalk script. Origin provides two windows for you to directly execute LabTalk script: Script Window and Command Window.

LabTalk scripts can be created and saved from any text editor, including Origin's Code Builder, and saved as OGS files. Script files can be organized in sections, and In Code Builder, you can edit, debug and run script by sections.

Alternatively, you can run LabTalk scripts by following means:




image

LabTalk scripts can be edited, debugged and run from Origin's Code Builder. The scripts can be saved as file and called from any project.

image

You can create a multi-buttons toolbar to assign LabTalk scripts in an OGS file to each of the buttons by sections .

image

You can assign LabTalk scripts to menu items to form a new main menu entry.

image

After importing, the entered LabTalk scripts in Import Wizard will be executed to output all peak information of imported spectrum.

Origin C

Origin C is a high level programming language closely based on the ANSI C programming language. Origin C also includes elements of C++ and C#. Origin C provides programmatic access to Origin's features such as, data import, data processing, graphing, analysis, and export capabilities.

Building Origin C Functions

Origin C code is developed in Origin's Integrated Development Environment (IDE) named Code Builder, which includes a source code editor with syntax highlighting, a workspace window, compiler, linker, and a debugger.

Read More>>

image

Origin C files can be added to Project folder for the use of a specific project or added to User [AutoLoad] folder to be used for any projects.


Developer Kit

The Developer Kit is a utility that allows users to build complex dialog boxes, floating tools, and wizards and access them from Origin C. Dialogs created using the Developer Kit can contain embedded Origin graphs and other third party components.

image

Dialog with National Instruments (TM) ActiveX Controls.

NAG Library

Origin includes, and Origin C has full access to, the entire Mark 26.1 Library from the Numerical Algorithms Group, Inc. (NAG). Having NAG functions accessible from Origin C allows you to develop custom applications that require advanced numerical computation.

image

NAG library offers a wide variety numerical algorithms covering many areas.

X Function

X-Functions provide a framework for building custom tools in Origin. Simply define what controls you want in your dialog and Origin will generate the dialog from your definition. Once an X-Function is created, it can be placed in the Origin menu, accessed from LabTalk script, and shared with other Origin users.

image

Visually creating an X-Function with preview panel in X-Function Builder.

Support for HTML Dialog with Java Script

Origin C now supports using HTML control for building a more flexible and sophisticated dialog box that interacts with Origin. Origin graphs can be placed on the HTML control with arbitrary positioning.

In order to access and control the elements in the HTML dialog, Origin provides methods for Origin C calling JavaScript and JavaScript calling Origin C.


image

The example displays a dialog box created with HTML. In this example, the user moves a vertical line on an inset graph. The dialog then interacts with Origin, calling JavaScript to read the X coordinate of the plot where it intersects the vertical line.

Apps

Extend Origin's graphing and analysis features by creating custom Apps. Share Apps via the File Exchange area of our website. End users can download the app and simply drag-and-drop to install. Apps will appear as icons in the App Gallery window in Origin. View information on how to create your own Apps.

image

You can browse Apps in Origin File Exchange website and drag-and-drop the package into Origin workspace to install.

The Apps Gallery in Origin 2017 supports multiple tabs. The user can add, rename, arrange and delete tabs, as needed. Additionally, you can show installed Apps on any tab (incl. "All" tabs) by right-clicking on the App icon in the Apps Gallery and choosing Tab Views.

Python

Origin provides an embedded Python environment so that you can run Python code in Origin. That includes:

  • originpro package for easy access to Origin objects.
  • Python IDE, including IntelliSense and debugging.
  • Script and GUI control to install and manage Python packages.
  • Access to Python functions from Column Formula, Fitting Functions, and Text Objects.
  • Access to Python functions from Labtalk and Origin C.


Read More>>

Running Python Commands

image

You can run single or multiple Python lines in Origin's Python Console.

Editing and Debugging Python Files

image

Code Builder: Select menu Connectivity: Open Untitled.py… to code a Python file in Code Builder window. Note that Python IDE now supports IntelliSense and debugging.


Using Python Codes in Set Column Value Dialog

image

Create Python function which can be immediately accessed in column formula.

Accessing Origin from Python

image

You can run Python codes to access Origin's objects by originpro package



Communicating with Other Applications

Integration with R

If your computer has access to R, you can directly run R commands or an R file from within Origin, as well as exchange data between Origin and R. This allows you to tap into the statistical computing power of R and combine that with with Origin’s advanced graphing capabilities.

Working with R in Origin, you will gain the following privileges:

  • Full access to the open-source cutting-edge statistical functionality of R.
  • Interactively exchange data and results between Origin and R, which optimally exploits the graphing capability of Origin and statistical functions of R.
  • Full compatibility with the core data types of R, such as matrix and data frame.
  • Both local and remote access to R via R Console and Rserve Console, respectively.
  • Full LabTalk access to R via R and Rserve objects.
  • Plotting the results obtained from R using Origin to create publication-quality figures.
image

You can prepare data in Origin and send to R for advanced statistics analysis, then receive results from R and plot it nicely in Origin.

Examples

MATLAB

You can import MATLAB workspace (*.MAT) files into Origin. If you have MATLAB installed on the same machine as Origin, you can transfer data between the two applications using theMATLAB Console.

With this tool, you can combine the computing power of MATLAB with the advanced graphing capabilities of Origin:

  • Import select data into Origin's workbooks or matrixbooks
  • Send worksheet or matrix data from Origin to MATLAB for analysis
  • Receive results from MATLAB and perform post-analysis in Origin
  • Explore data graphically in Origin including easy zoom and scroll
  • Customize publication quality graphs with ease



Connecting with MATLAB:

image

In this example, we analyzed a TEM image and obtained the radius distribution data in MATLAB Console. The results are then being plotted as histogram with distribution curve in Origin.



Examples

Mathematica

Origin Link for Mathematica is an easy-to-use tool that can create a link between Origin and the Mathematica kernel. Exchange data, and send expressions to evaluate in Mathematica. Create your graph in Origin, using one of our many plot types, and customize the graph with our easy point-and-click interface to prepare your final presentation.

This tool consists of a multi-tabbed dialog box that allows data and expressions to be transferred between Mathematica and Origin. With the tool, you can:

  • Send worksheet or matrix data from Origin to Mathematica
  • Get data from Mathematica into an Origin worksheet or matrix
  • Generate a graph in Origin using a Mathematica function
  • Evaluate the results of a Mathematica expression in Origin


More Examples>>

image

From the Mathematica Link, you can exchange data between Mathematica and Origin, evaluate Mathematica expressions and create graphs using Mathematica functions.

LabVIEW

Origin ships with a library of custom LabVIEW VIs that can be used to communicate with Origin. These custom VIs can be used for operations such as opening and closing Origin application, pushing data into Origin Projects and Analysis Templates, sending script commands to Origin, creating graphs, and saving projects.

In order to access these Origin sub-VIs in the LabVIEW Functions Palette, select Tools: Copy Origin Sub-VI to LabVIEW vi.lib\addons\Origin... to automatically copy these files and optionally delete any older versions of these files.



Step-by-Step Tutorials>>

More Examples>>

Real-time DAQ Analysis:

image

This example shows you how to acquire data using National Instruments USB-6009 multifunction I/O devices. It will show how to plot the acquired data dynamically both in Origin and LabView.

Automation Server

Origin can function as an Automation Server for client applications such as Microsoft® Excel®, Microsoft® Visual Basic® which supports COM programming.

Data can be passed to Origin from the client application, graphed, analyzed, and the result exported or brought back into your application. The Origin application can be optionally hidden from end user.

A typical client application may involve some, or many, of the following steps:

  1. Launching the Origin application.
  2. Opening a previously customized Origin project or preparing the default project (by opening Analysis Templates™, workbooks, matrices, graphs, etc.) to receive data from the client application.
  3. Sending data (collected from hardware) to Origin workbooks and matrices.
  4. Sending commands to Origin to process the data or have Origin update result columns using the recalculate analysis feature.
  5. Getting results back from Origin worksheets and matrices.
  6. Getting images of graphs and layout pages back from Origin.
  7. Saving the Origin project.
  8. Closing the Origin application.
image

This example illustrates connecting an Excel Client application to Origin: Origin is launched and a previously customized Origin Project is opened; data is sent from Excel to Origin; analysis results are automatically updated by Origin on data change; analysis results and graph images are fetched back to Excel from Origin.



Examples of Accessing Origin from Client Applications

Visual Basic

image

This example shows a Visual Basic tool which simply generates some random numeric data and some texts, then places them in a sheet in an Origin workbook specified by the user.



MATLAB

image

This example shows a simple routine to use MATLAB as a client application to connect to the Origin server application. It loads a previously customized Origin Project file and sends MATLAB data to the worksheet.

LabVIEW

image

In this example, data is sent to Origin from LabVIEW and displayed in a graph. The graph is updated as more data is collected, allowing the user to inspect and analyze the data on-the-fly. Origin’s FFT Gadget tool is used to display the frequency spectrum over a region-of-interest. The user can change the region-of-interest rectangle, and the FFT result updates dynamically, allowing for inspection and analysis of the data during acquisition. More Examples>>




Additional Connectivities...>>

Orglab

Origin provides a set of files called Orglab, for your custom applications to be able to read or write Origin project (.opj) and window (.ogg, .ogw and .ogm) files. Your custom application will communicate with Orglab using COM.



Read More>>

© OriginLab Corporation. All rights reserved.
× _ Let's Chat