This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Form blank-padded character matrix from strings

    Note:   str2mat is not recommended. Use char instead.


S = str2mat(T1, T2, T3, ...)


S = str2mat(T1, T2, T3, ...) forms the matrix S containing the text strings T1, T2, T3, ... as rows. The function automatically pads each string with blanks in order to form a valid matrix. Each text parameter, Ti, can itself be a string matrix. This allows the creation of arbitrarily large string matrices. Empty strings are significant.


x = str2mat('36842', '39751', '38453', '90307');

whos x
  Name      Size         Bytes  Class

  x         4x5             40  char array


ans =



str2mat differs from strvcat in that empty strings produce blank rows in the output. In strvcat, empty strings are ignored.

See Also

Introduced before R2006a

Was this topic helpful?