Documentation

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.

str2mat

(Not recommended) Form blank-padded character array from strings

str2mat is not recommended. Use char instead.

Syntax

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

Description

S = str2mat(T1, T2, T3, ...) forms the character array S containing the character arrays T1, T2, T3, ... as rows. The function automatically pads each row with blanks in order to form a valid matrix. Each input argument, Ti, can itself be a character array with one or more rows. This allows the creation of arbitrarily large character arrays. Empty character arrays are significant.

Examples

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

whos x
  Name      Size         Bytes  Class

  x         4x5             40  char array

x(2,3)

ans =

    7

Tips

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

See Also

Introduced before R2006a

Was this topic helpful?