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 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:
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.
You can create a multi-buttons toolbar to assign LabTalk scripts in an OGS file to each of the buttons by sections .
You can assign LabTalk scripts to menu items to form a new main menu entry.
After importing, the entered LabTalk scripts in Import Wizard will be executed to output all peak information of imported spectrum.
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.
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.
Dialog with National Instruments (TM) ActiveX Controls.
Origin includes the entire Mark VII Library from the Numerical Algorithms Group, Inc. (NAG). NAG functions are accessible from Origin C and allow you to develop applications that require advanced numerical computation.
NAG library offers a wide variety numerical algorithms covering many areas.
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.
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.
You can browse Apps in Origin File Exchange website and drag-and-drop the package into Origin workspace to install.
Communicating with Other Applications
You can run Python command line(s) or run a Python file in Origin or access Origin objects from Python through the PyOrigin module. Additionally you can use other Python extensions such as PyQt4 and numpy.
Running Python Commands
You can run single or multiple Python lines in Origin's Python Console.
Editing Python Codes
You can edit Python codes in Code Builder with syntax coloring, but need to run it through LabTalk scripts.
Accessing Origin from Python
You can run Python codes to access Origin's objects by PyOrigin module.
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.
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.
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:
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.
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
From the Mathematica Link, you can exchange data between Mathematica and Origin, evaluate Mathematica expressions and create graphs using Mathematica functions.
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.
Real-time DAQ Analysis:
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.
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:
- Launching the Origin application.
- 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.
- Sending data (collected from hardware) to Origin workbooks and matrices.
- Sending commands to Origin to process the data or have Origin update result columns using the recalculate analysis feature.
- Getting results back from Origin worksheets and matrices.
- Getting images of graphs and layout pages back from Origin.
- Saving the Origin project.
- Closing the Origin application.
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
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.
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.
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>>
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.