SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

MERGE

Name:
    MERGE (LET)
Type:
    Library Function
Purpose:
    Merge two values based on the value of a tag value.
Description:
    Given values Y1 and Y2 and a tag value TAG, the merged value is Y1 if TAG = 0 and Y2 if TAG = 1.

    Note that any value of TAG less than or equal to 0 will be treated as a 0 and any value of TAG that is greater than 0 will be treated as a 1.

    There is an alternate version of this command (see Syntax 2) that selects one of three values depending on whether the value of TAG is negative, zero, or positive.

Syntax 1:
    LET <y> = MERGE(<y1>,<y2>,<tag>)
                      <SUBSET/EXCEPT/FOR qualification>
    where <y1> is a variable or a parameter;
                <y2> is a variable or a parameter;
                <tag> is a variable or a parameter;
                <y> is a variable or a parameter (depending on what <y1>, <y2>, and <tag> are) where the computed merged values are stored; and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Syntax 2:
    LET <y> = MERGE3(<y1>,<y2>,<y3>,<tag>)
                      <SUBSET/EXCEPT/FOR qualification>
    where <y1> is a variable or a parameter;
                <y2> is a variable or a parameter;
                <y3> is a variable or a parameter;
                <tag> is a variable or a parameter;
                <y> is a variable or a parameter (depending on what <y1>, <y2>, <y3>, and <tag> are) where the computed merged values are stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET A = MERGE(14,10,1)
    LET A = MERGE(14,10,0)
    LET A = MERGE(A1,A2,TAG)
    LET X2 = MERGE(X1,X4,TAG)
    LET Y = MERGE3(X1,X2,X3,TAG)
Note:
    If more than one argument is a variable, the variables must be the same length.
Note: Default:
    None
Synonyms:
    None
Related Commands:
    MERGE = Merge two data sets.
    RELDIF = Compute the relative difference of two numbers.
    RELERR = Compute the relative error of two numbers.
    PERCDIF = Compute the percent difference of two numbers.
    PERCERR = Compute the percent error of two numbers.
    MIN = Compute the minimum of two numbers.
    MAX = Compute the maximum of two numbers.
    ABS = Compute the absolute value of a number.
Applications:
    Data Management
Implementation Date:
    2010/12
Program:
     
    let y1 = sequence 1 1 20
    let y2 = sequence -1 -1 -20
    let y3 = 0 for i = 1 1 20
    let tag = sequence 0 1 1 for i = 1 1 20
    let tag2 = sequence -1 1 1 for i = 1 1 20
    .
    let yout = merge(y1,y2,tag)
    set write decimals 1
    print yout
        
    The following output is printed:
    ---------------
               YOUT
    ---------------
                1.0
               -2.0
                3.0
               -4.0
                5.0
               -6.0
                7.0
               -8.0
                9.0
              -10.0
               11.0
              -12.0
               13.0
              -14.0
               15.0
              -16.0
               17.0
              -18.0
               19.0
              -20.0
        
    let yout = merge3(y1,y2,y3,tag2)
    set write decimals 1
    print yout
        
    The following output is printed:
    ---------------
               YOUT
    ---------------
                1.0
               -2.0
                0.0
                4.0
               -5.0
                0.0
                7.0
               -8.0
                0.0
               10.0
              -11.0
                0.0
               13.0
              -14.0
                0.0
               16.0
              -17.0
                0.0
               19.0
              -20.0
        

Date created: 01/06/2011
Last updated: 01/06/2011
Please email comments on this WWW page to alan.heckert@nist.gov.