2.2.3.56 wmergexy

Brief Information

Merge XY data from two worksheets based on X values

Additional Information

Minimum Origin Version Required: 8.0 SR5

Command Line Usage

1. wmergexy iy:=(1,2) oy:=(3,4)

2. wmergexy iy:=sheet1!(1,2) oy:=sheet2!(1,2) label:=L

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iy

Input

XYRange

<unassigned>
Specify the XY range to copy
Output oy

Input/Output

XYRange

<unassigned>
Specify the destination for the copied data
Labels to Copy label

Input

string

Specify which column label to copy. This is a string following the same convention as in wks.Labels. For example, label:=L will copy Long Name, label:=LC will copy Long name and Comments.

Description

This X-Function is used to merge XY data according to the X values.

For each row in the input range, the X-Function looks at the output range and see if an equal X value exists. If no equal X value is found, copy this row to the output range. Otherwise, replace the Y value that corresponds to the X value in the output range with the Y value in this row.

You can also copy row labels from the input range to the output range at the same time.

Example

There are XY data in two worksheets, and you want to combine all the data into one worksheet. The datasets do not have common any X values.

Suppose the datasets are already in Origin workbooks like below:

Wmergexy-1.png Wmergexy-2.png

You can perform the following steps to combine them:

  1. Enter wmergexy -d in the Command Window to open the dialog box of the X-Function.
  2. Click the Interactive Range Selector button Wmergexy-3.png next to Input and select the columns from the fftfilter1 worksheet. Then click the button to the right of the rolled up dialog box Wmergexy-4.png.
  3. Click the Interactive Range Selector button Wmergexy-3.png next to Output and select the columns from the fftfilter2 worksheet. Then click the button to the right of the rolled up dialog box Wmergexy-4.png.
  4. Enter L in the edit box of Labels to Copy.
    Wmergexy-6.png
  5. Click the OK button and you will get the result:
    Wmergexy-5.png

Two worksheets have been combined. Also, the Long names have been copied.