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

STRING HAMMING DISTANCE

Name:
    STRING HAMMING DISTANCE
Type:
    Let Subcommand
Purpose:
    Given two equal length strings, returns the count of the number of character positions that match.
Syntax:
    LET <dist> = STRING HAMMING DISTANCE <s1> <s2>
    where <dist> is a parameter containing the Hamming distance;
                <s1> is the name of a pre-existing string;
    and     <s2> is the name of a pre-existing string.

    The <s1> and <s2> strings must be the same length.

Examples:
    LET IFLAG = STRING HAMMING DISTANCE S1 S2
Note:
    The strings on the right hand side of the equal sign must be previously existing strings. That is, expressions are not allowed. For example, the following will result in an error message

      LET IFLAG = STRING HAMMING DISTANCE "gmail.com" "gmail.org"

    you need to do

      LET STRING S1 = gmail.com
      LET STRING S2 = gmail.org
      LET SOUT = STRING HAMMING DISTANCE S1 S2

    The name on the left hand side of the equal sign may be a previously existing parameter. However, if it is a previously existing string, variable, or matrix name, an error will be reported and the requested parameter will not be created.

Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Data Management
Implementation Date:
    2018/10
Program:
     
    LET STRING S1 = 1011100111
    LET STRING S2 = 1010010110
    LET DIST = STRING HAMMING DISTANCE S1 S2
    PRINT DIST
        
    The following output is returned
     
     PARAMETERS AND CONSTANTS--
    
         DIST    --  0.4000000E+01
        

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 10/10/2018
Last updated: 10/10/2018

Please email comments on this WWW page to alan.heckert@nist.gov.