Skip to main content
Logo image

Section 3.3 Strings as String Arrays

Newer versions of MATLAB support another string type which makes it possible to store multiple such strings in an array without the need for padding. Each individual string is also called a string scalar. To use these so-called string arrays (as opposed to the above described character arrays) you enclose text in double quotes:
>> name = "this is a string"
Using this string datatype it is easy to create an array of strings without having to worry about padding:
>> easy = ["a"; "ab"; "abc"]
easy =
    3×1 string array
     
      "a"
      "ab"
      "abc"