Language Reference

LENGTH Function

finds the lengths of character matrix elements

LENGTH( matrix)

where matrix is a character matrix or quoted literal.

The LENGTH function takes a character matrix as an argument and produces a numeric matrix as a result. The result matrix has the same dimensions as the argument and contains the lengths of the corresponding string elements in matrix. The length of a string is equal to the position of the rightmost nonblank character in the string. If a string is entirely blank, its length value is set to 1. An example of the LENGTH function follows:

  
    c={'Hello' 'My name is Jenny'}; 
    b=length(c); 
  
                 B             1 row       2 cols    (numeric) 
  
                                      5        16
 
See also the description of the NLENG function.

Previous Page | Next Page | Top of Page