2.19.2 LabTalk-Supported X-Functions

Below are several X-Functions, arranged by category, that are used frequently in LabTalk script.

This is not a complete list of X-Functions in Origin, but only those supported by LabTalk! For a complete listing of all X-Functions, arranged by category and alphabetical, see the X-Function Reference.

Data Exploration

Name Brief Description
addtool_curve_deriv Place a rectangle on the plot to perform differentiation
addtool_curve_fft Add a rectangle onto the plot to perform FFT
addtool_curve_integ Attach a rectangle on the plot to perform integration
addtool_curve_interp Place a rectangle on the plot to perform interpolation
addtool_curve_stats Place a rectangle onto the plot to calculate basic statistics
addtool_quickfit Place a rectangle onto the plot to do fitting
addtool_region_stats Region Statistics:Place a rectangle or circle onto the plot to calculate basic statistics
dlgRowColGoto Go to specified row and column
imageprofile Open the Image Profile dialog.
vinc Calculate the average increment in a vector
vinc_check Calculate the average increment in a vector

Data Manipulation

Name Brief Description
addsheet Set up data format and fitting function for Assays Template
assays Assays Template Configuration:Set up data format and fitting function for Assays Template
copydata Copy numeric data
cxt Shift the x values of the active curve with different mode
levelcrossing Get x coordinate crossing the given level
m2v Convert a matrix to a vector
map2c Combine an amplitude matrix and a phase matrix to a complex matrix.
mc2ap Convert complex numbers in a matrix to amplitudes and phases.
mc2ri Convert complex numbers in a matrix into their real parts and imaginary parts.
mcopy Copy a matrix
mks Get data markers in data plot
mo2s Convert a matrix layer with multiple matrix objects to a matrix page with multiple matrix layers.
mri2c Combine real numbers in two matrices into a complex matrix.
ms2o Merge (move) multiple matrixsheets into one single matrixsheet with multiple matrixobjects.
newbook Create a new workbook or matrixbook
newsheet Create new worksheet.
rank Decide whether data points are within specified ranges
reducedup Reduce Duplicate X Data
reduce_ex Average data points to reduce data size and make even spaced X
reducerows Reduce every N points of data with basic statistics
reducexy Reduce XY data by sub-group statistics according to X's distribution
subtract_line Subtract the active plot from a straight line formed with two points picked on the graph page
subtract_ref Subtract on one dataset with another
trimright Remove missing values from the right end of Y columns
v2m Convert a vector to matrix
vap2c Combine amplitude vector and phase vector to form a complex vector.
vc2ap Convert a complex vector into a vector for the amplitudes and a vector for the phases.
vc2ri Convert complex numbers in a vector into their real parts and imaginary parts.
vfind Find all vector elements whose values are equal to a specified value
vri2c Construct a complex vector from the real parts and imaginary parts of the complex numbers
vshift Shift a vector
xy_resample Mesh within a given polygon to resample data.
xyz_resample Resample XYZ data by meshing and gridding

Gridding

Name Brief Description
m2w Convert the Matrix data into a Worksheet
r2m Convert a range of worksheet data directly into a matrix
w2m Convert the worksheet data directly into a matrix, whose coordinates can be specified by first column/row and row labels in the worksheet.
wexpand2m Convert Worksheet to Matrix by expand for columns or rows
XYZ2Mat Convert XYZ worksheet data into matrix
xyz_regular Regular Gridding
xyz_renka Renka-Cline Gridding Method
xyz_renka_nag NAG Renka-Cline Gridding Method
xyz_shep Modified Shepard Gridding Method
xyz_shep_nag NAG Modified Shepard Gridding Method
xyz_sparse Sparse Gridding
xyz_tps Thin Plane Spline interpolation

Matrix

Name Brief Description
mCrop Crop matrix to a rectangle area
mdim Set the dimensions and values of XY coordinates for the active matrix
mexpand Expand for every cell in the active matrix according to the column and row factors
mflip Flip the matrix horizontally or vertically
mproperty Set properties of the active matrix
mreplace Replace cells in the active matrix with specified datamreplace
mrotate90 Rotates the matrix 90/180 degreesmrotate90
msetvalue Assign each cell in the active matrix from the user definited formula
mshrink Shrink matrix according shrinkage factors
mtranspose Transpose the active matrix

Plotting

Name Brief Description
plotbylabel Plot a multiple-layers graph by grouping on column labels
plotgroup Plot by page group, layer group, and data group
plotmatrix Plot scatter matrix of the dataset
plotmyaxes Customize Multi-Axes plot
plotstack Plot stacked graph
plotxy Plot XY data with specific properties
plotms Plot color fill surfaces or colormap surfaces for all matrix objects in the specified matrixsheet.
plotvm Plot from a range of cells in worksheet as a virtual matrix

Worksheet

Name Brief Description
colcopy Copy columns with format & headers
colint Set Sampling Interval (Implicit X) for selected Y columns
colmask Mask a range of columns based on some condition
colmove Move selected columns
colshowx Show X column (extract Sampling Interval) for the selected Y column(s)
colswap Swap the position of two selected columns
filltext Fill the cell in the specified range with random letters
getresults Get the result tree
insertArrow Insert arrow
insertGraph Insert a graph into a worksheet cell
insertImg Insert images from files
insertNotes Embed a Notes page into a worksheet cell
insertSparklines Insert sparklines into worksheet cells
insertVar Insert Variables into cells
merge_book Merge the workbooks to a new workbook.
sparklines Add thumbnail size plots of each Y column above the data
updateEmbedGraphs Update the embedded Graphs in the worksheet.
updateSparklines Add thumbnail size plots of each Y column above the data
w2xyz Convert formatted data into XYZ form
wautofill Worksheet selection auto fill
wautosize Resize the worksheet by the column maximal string length.
wcellcolor Set cell(s) color to fill color or set the selected character font color to Font color.
wcellformat Format the selected cells
wcellmask Set cell(s) mask in specified range
wcellsel Select cell(s) with specified condition
wclear Worksheet Clear
wcolwidth Update the width of columns in worksheet
wcopy Create a copy of the specified worksheet
wdeldup Remove Duplicated Rows:Remove rows in a worksheet based on duplications in one column
wdelrows Delete specified worksheet rows
wkeepdup Hold Duplicated Rows:Hold rows in a worksheet based on duplications in one column
wks_update_link_table Update the contents in the worksheet to the linked table on graph
wmergexy Copy XY data from one worksheet to another and merge mismatching X by inserting empty rows when needed
wmove_sheet Move the specified worksheet to the destination workbook
wmvsn Reset short names for all columns in worksheet
wpivot Pivot Table:Create a pivot table to visualize data summarization
wproperties Get or set the worksheet property through a tree from script
wrcopy Worksheet Range Copy with options to copy labels
wreplace Find and replace cell value in a worksheet
wrow2label Set Label Value
wrowheight Set row(s) height
wsort Sort an entire worksheet or selected columns
wsplit_book Split specific workbooks into multiple workbooks with single sheet
wtranspose Transpose the active worksheet
wunstackcol UnStack grouped data into multiple columns
wxt Worksheet Extraction

Database Access

Name Brief Description
dbEdit Create/Edit/Remove/Load Query
dbImport Import data from database through the query
dbInfo Show database connection information
dbPreview Import to certain top rows for previewing the data from the query

Fitting

Name Brief Description
findBase Find Baseline region in XY data
fitcmpdata Compare two datasets to the same fit model
fitcmpmodel Compare two fit models to the same dataset
fitLR Simple Linear Regression for LabTalk usage
fitpoly Polynomial fit for LabTalk usage
getnlr Get NLFit tree from a fitting report sheet
nlbegin Start a LabTalk nlfit session
nlbeginm Start a LabTalk nlfit session on matrix data
nlbeginr Start a LabTalk nlfit session and fit multiple dependent/independent variables function.
nlbeginz Start a LabTalk nlfit session on xyz data
nlend Terminate an nlfit session
nlfit Iterate the nl fit session
nlfn Set Automatic Parameter Initialization option
nlgui Control NLFIT output quantities and destination.
nlpara Open the Fitting Parameter dialog.

Graph Manipulation

Name Brief Description
add_graph_to_graph Paste a graph from existing graphs as an EMF object onto a layout window
add_table_to_graph Add a linked table to graph
add_wks_to_graph Paste a worksheet from existing worksheets onto a layout window
add_xyscale_obj Add a new XY Scale object to the layer
axis_scrollbar Add a scrollbar object to graph to allow easy zooming and panning
axis_scroller Add a pair of inverted triangles to the bottom X-Axis that allows easy rescaling
g2w Move graphs into worksheet
gxy2w For a given X value, find all Y values from all curves and add them as a row to a worksheet
layadd Create a new layer on the active graph
layalign Align some destination layers according to the source layer.
layarrange Arrange the layers on the graph.
laycolor Fill layer background color
laycopyscale Copy scale from one layer to another layer
layextract Extract specified layers to separate graph windows
laylink Link several layers to a layer.
laymanage Manage the organization of layers in the active graph
laysetfont Fix the display scaling of text in the layer(s) to one.
laysetpos Set position of one or more graph layers.
laysetratio Set ratio of layer width to layer height.
laysetscale Set axes scales for graph layers.
laysetunit Set unit for graph layers.
layswap Swap the positions of two graph layers.
laytoggle Toggle the left axis and bottom axis on and off.
layzoom Center zooms on layer
legendupdate Update or reconstruct legend on the graph page/layer
merge_graph Merge selected graph windows into one graph
newinset Create a new graph page with insets
newpanel Create a new graph with panels
palApply Apply Palette to &Color Map:Apply palette to the specified graph with an existing palette file
pickpts Pick XY data points from a graph
speedmode Set speed mode properties

Image

Adjustments

Name Brief Description
imgAutoLevel Apply auto leveling to image
imgBalance Balance the color of image
imgBrightness Adjust the brightness of Image
imgColorlevel Apply user-defined color leveling to image
imgColorReplace Replace color within pre-defined color range
imgContrast Adjust contrast of image
imgFuncLUT Apply lookup table function to image
imgGamma Apply gamma correction to image
imgHistcontrast Adjust the contrast of image, using histogram to calculate the median.
imgHisteq Apply histogram equalization
imgHue Adjust hue of image
imgInvert Invert image color
imgLevel Adjust the levels of image
imgSaturation Adjust Saturation of image

Analysis

Name Brief Description
imgHistogram Image histogram

Arithmetic Transform

Name Brief Description
imgBlend Blend two images into a combined image
imgMathfun Perform math function on image pixel values with a factor
imgMorph Apply morphological filter to numeric Matrix or grayscale/binary image
imgPixlog Perform logic operation on pixels
imgReplaceBg Replace background color
imgSimpleMath Simple Math operation between two Images
imgSubtractBg Subtract image background

Conversion

Name Brief Description
img2m Convert a grayscale image to a numeric data matrix
imgAutoBinary Auto convert to binary
imgBinary Convert to binary
imgC2gray Convert to a grayscale image
imgDynamicBinary Convert to binary using dynamic threshold
imgInfo Print out the given image's basic parameters in script window
imgPalette Apply palette to image
imgRGBmerge Merge RGB channels to recombine a color image
imgRGBsplit Split color image into R,G, B channels
imgThreshold Convert part of an image to black and white using threshold
m2img Convert a numeric matrix to a grayscale image

Geometric Transform

Name Brief Description
imgCrop Crop image to a rectangle area
imgFlip Flip the image horizontally or vertically
imgResize Resize image
imgRotate Rotates an image by a specified degree
imgShear Shear the image horizontally or vertically
imgTrim Trim image with auto threshold settings

Spatial Filters

Name Brief Description
imgAverage Apply average filter to image
imgClear Clear the image
imgEdge Detecting edges
imgGaussian Apply Gaussian filter
imgMedian Apply median filter
imgNoise Add random noise to image
imgSharpen Increase or decrease image sharpness
imgUnsharpmask Apply unsharp mask
imgUserfilter Apply user defined filter

Import and Export

Name Brief Description
batchProcess Batch processing with Analysis Template to generate summary report
expASC Export worksheet data as ASCII file
expGraph Export graph(s) to graphics file(s)
expImage Export the active Image into a graphics file
expMatASC Export matrix data as ASCII file
expNITDM Export workbook data as National Instruments TDM and TDMS files
expPDFw Export worksheet as multipage PDF file
expWAV Export data as Microsoft PCM wave file
expWks Export the active sheet as raster or vector image file
img2GIF Export the active Image into a gif file
impASC Import ASCII file/files
impBin2d Import binary 2d array file
impCDF Import CDF file. It supports the file version lower than 3.0
impCSV Import csv file
impDT Import Data Translation Version 1.0 files
impEDF Import EDF file
impEP Import EarthProbe (EPA) file. Now only EPA file is supported for EarthProbe data.
impExcel Import Microsoft Excel 97-2007 files
impFamos Import Famos Version 2 files
impFile Import file with pre-defined filter.
impHDF5 Import HDF5 file. It supports the file version lower than 1.8.2
impHEKA Import HEKA (dat) files
impIgorPro Import WaveMetrics IgorPro (pxp, ibw) files
impImage Import a graphics file
impinfo Read information related to import files.
impJCAMP Import JCAMP-DX Version 6 files
impJNB Import SigmaPlot (JNB) file. It supports version lower than SigmaPlot 8.0.
impKG Import KaleidaGraph file
impMatlab Import Matlab files
impMDF Import ETAS INCA MDF (DAT, MDF) files. It supports INCA 5.4 (file version 3.0).
impMNTB Import Minitab file (MTW) or project (MPJ). It supports the version prior to Minitab 13.
impNetCDF Import netCDF file. It supports the file version lower than 3.1.
impNIDIAdem Import National Instruments DIAdem 10.0 dat files
impNITDM Import National Instruments TDM and TDMS files(TDMS does not support data/time format)
impODQ Import *.ODQ files.
imppClamp Import pCLAMP file. It supports pClamp 9 (ABF 1.8 file format) and pClamp 10 (ABF 2.0 file format).
impSIE Import nCode Somat SIE 0.92 file
impSPC Import Thermo File
impSPE Import Princeton Instruments (SPE) file. It supports the version prior to 2.5.
impWav Import waveform audio file
insertImg2g Insert Images From Files:Insert graphic file(s) into Graph Window
Iwfilter Make an X-Function import filter
plotpClamp Plot pClamp data
reimport Re-import current file

Mathematics

Name Brief Description
avecurves Average or concatenate multiple curves
averagexy Average or concatenate multiple curves
bspline Perform cubic B-Spline interpolation and extrapolation
csetvalue Setting column value
differentiate Calculate derivative of the input data
filter2 Apply customized filter to a Matrix
integ1 Perform integration on input data
integ2 Calculate the volume beneath the matrix surface from zero panel.
interp1 Perform 1D interpolation or extrapolation on a group of XY data to find Y at given X values using 3 alternative methods.
interp1q Perform linear interpolation and extrapolation
interp1trace Perform trace/periodic interpolation on the data
interp1xy Perform 1D interpolation/extrapolation on a group of XY data to generate a set of interpolated data with uniformly-spaced X values using 3 alternative methods.
interp3 Perform 3D interpolation
interpxyz Perform trace interpolation on the XYZ data
marea Calculate the area of the matrix surface
mathtool Perform simple arithmetic on data
medianflt2 Apply median filter to a matrix
minterp2 2D Interpolate/Extrapolate on the matrix
minverse Generate (pseudo) inverse of a matrix
normalize Normalize the input data
polyarea Calculate the area of an enclosed plot region
reflection Reflect a range of data to certain interval
rnormalize Normalize Columns:Normalize the input range column by column
specialflt2 Apply predefined special filter to a matrix
spline Perform spline interpolation and extrapolation
vcmath1 Perform simple arithmetic on one complex number
vcmath2 Perform simple arithmetic on two complex numbers
vmathtool Perform simple arithmetic on input data
vnormalize Normalize the input vector
white_noise Add white (Gaussian) noise to data
xyzarea Calculate the area of the XYZ surface

Signal Processing

Name Brief Description
cohere Perform coherence
conv Compute the convolution of two signals
corr1 Compute 1D correlation of two signals
corr2 2D correlation.
deconv Compute the deconvolution
envelope Get envelope of the data
fft_filter2 Perform 2D FFT filtering
fft_filters Perform FFT Filtering
hilbert Perform Hilbert transform or calculate analytic signal
msmooth Smooth the matrix by expanding and shrinking
smooth Perform smoothing to irregular and noisy data.

FFT

Name Brief Description
fft1 Fast Fourier transform on input vector (discrete Fourier transforms)
fft2 Two-dimensional fast Fourier transform
ifft1 Perform inverse Fourier transform
ifft2 Inverse two-dimensional discrete Fourier transform
stft Perform Short Time Fourier Transform
unwrap Transfer phase angles into smoother phase

Wavelet

Name Brief Description
cw_evaluate Evaluation of continuous wavelet functions
cwt Computes the real, one-dimensional, continuous wavelet transform coefficients
dwt 1D discrete wavelet transform
dwt2 Decompose matrix data with wavelet transform
idwt Inverted 1D Wavelet Transform from its approximation coefficients and detail coefficients.
idwt2 Reconstruct 2D signal from coefficients matrix
mdwt Multilevel 1-D wavelet decomposition
wtdenoise Remove noise using wavelet transform
wtsmooth Smooth signal by cutting off detailed coefficients

Spectroscopy

Name Brief Description
blauto Create baseline automatically
fitpeaks Pick multiple peaks from a curve to fit Guassian or Lorentzian peak functions
pa Open Peak Analyzer
paMultiY Peak Analysis batch processing using Analysis Theme to generate summary report
pkFind Pick peaks on the curve.

Statistics

Descriptive Statistics

Name Brief Description
colstats Perform statistics on columns
corrcoef Calculate correlation coefficients of the selected data
discfreqs Calculate Frequency for discrete/categorical data
freqcounts Calculate frequency counts
kstest One sample Kolmogorov-Smirnov test for normality
lillietest Lilliefors normality test
mmoments Calculate moments on selected data
moments Calculate moments on selected data
mquantiles Calculate quantiles on selected data
mstats Calculate descriptive statistics on selected data
quantiles Calculate quantiles on selected data
rowquantiles Calculate quantiles on row(s)
rowstats Descriptive statistics on row(s)
stats Calculate descriptive statistics on selected data
swtest Shapiro-Wilk test for normality:Shapiro-Wilk Normality test

Hypothesis Testing

Name Brief Description
rowttest2 Perform a two-sample t-test on rows
ttest1 One-Sample t-test
ttest2 Two-Sample t-test
ttestpair Pair-Sample t test
vartest1 Chi-squared variance test
vartest2 Perform a F-test.

Nonparametric Tests

Name Brief Description
friedman Perform a Friedman ANOVA
kstest2 Perform a two-sample KS-test on the input data.
kwanova Perform Kruskal-Wallis ANOVA
mediantest Perform median test
mwtest Preform Mann-Whitney test
sign2 Perform paired sample sign test
signrank1 Perform a one-sample Wilcoxon signed rank test
signrank2 Preform paired sample Wilcoxon signed rank test

Survival Analysis

Name Brief Description
kaplanmeier Perform a Kaplan-Meier (product-limit) analysis
phm_Cox Perform a Cox Proportional Hazards Model analysis
weibullfit Perform a Weibull fit on survival data

Utility

Name Brief Description
customMenu Open Custom Menu Editor Dialog.
get_plot_sel Get plot selections in data plot
get_wks_sel Get selections in worksheet
themeApply2g Apply a theme to a graph or some graphs.
themeApply2w Apply a theme to a worksheet or some worksheets.
themeEdit Edit the specific theme file using Theme Editing tool.
xop X-Function to run the operation framework based classes.

File

Name Brief Description
cmpfile Compare two binary files and print out comparison results
dlgFile Prompt user to select a file with an Open file dialog.
dlgPath Prompt user to select a path with an Open Path dialog.
dlgSave Prompt user with an Save as dialog.
filelog Create a .txt file that contains notes or records of the user's work through a string
findFiles Searches for a file or files.
findFolders Searches for a folder or folders.
imgFile Prompt user to select an image with an Open file dialog.
template_saveas Save a graph/workbook/matrix window to a template
web2file Copy a web page to a local file

System

Name Brief Description
cd Change or show working directory
cdset Assigns a specified index to the current working directory, or lists all assigned indices and associated paths.
debug_log Used to create a debug log file. Turn on only if you have a problem to report to OriginLab.
dir list script (ogs) and x-functions (oxf) in current working directory.
dlgChkList Open a dialog with check boxes and return each check box's selected status when the dialog is closed.
group_server Set up the Group Folder location for both group leader and members
groupmgr Group Leader's tool to manage Group Folder files
instOPX Install an Origin XML Package
language Change Origin Display Language
lc Lists x-function categories, or all x-functions in a specified category.
lic Update Module License:Add module license file into Origin
lx Lists x-functions (by name, keyword, location etc)
mkdir Create a new folder in the current working directory
op_change Get and set tree stored in operation object
pb Open the Project Browser
pe_cd Change project explorer directory
pe_dir Lists current project explorer folders and workbooks
pe_load Load an Origin project into an existing folder in the current project
pe_mkdir Create new folder
pe_move Move specified page of folder to specified folder
pe_path Find Project Explorer path
pe_rename Rename Page or subfolder
pe_rmdir Delete a subfolder under the active folder in PE
pe_save Save a folder from the current project to an Origin project file
pef_pptslide Export all graphs in folder to PowerPoint Slides
pef_slideshow Slide Show (full screen view) of all graphs in folder
pemp_pptslide Export selected graphs to PowerPoint Slides
pemp_slideshow Slide Show (full screen view) of selected graphs
pep_addshortcuts Create shortcuts for selected windows in Favorites folder
pesp_gotofolder Go to the original folder where this page locates
updateUFF Transfer user files in Origin75 to Origin8
ux Update x-function list in specified location