Method Reference: string.eq

string: TF = eq (A, B)

Test for equality.

TF is true, if string A is lexicographically equal to B. If one input is a string array, the other input can be a string array, a character vector, or a cell array of character vectors. This is equivalent to the strcmp function.

Source Code: string

Example: 1

eq (==) compares strings for equality, element by element.

 a = string ({'cat'; 'dog'; 'cat'})
a =
  3x1 string array

    "cat"    
    "dog"    
    "cat"
 a == 'cat'
ans =

  1
  0
  1