Origin 8.6

Programming in Origin

Origin_code_builder

Origin is designed to meet the graphing and analysis needs of scientists and engineers in diverse areas of academics and industry. To accomplish this, Origin provides a broad range of tools for importing, analysing, graphing, presenting, and exporting data. As you gain familiarity with Origin, you may want to customise Origin to meet your specific graphing and analysis needs. To facilitate your customisation, Origin includes two complimentary programming languages: Origin C and LabTalk.

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.

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 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 customisations 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.

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.

NAG Software Partner

Origin includes essential elements of the numerical computational routines from Numerical Algorithms Group, Inc. (NAG). Over 300 built-in NAG routines have been selected from the NAG C Library. 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 customise 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\Programming\ subfolders.

To see how other users have programmatically customised Origin, browse the OriginLab File Exchange.

Rate this page
Comment