Documentation Center

  • Trial Software
  • Product Updates
我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

cellstr

Create cell array of strings from character array

Syntax

c = cellstr(S)

Description

c = cellstr(S) places each row of the character array S into separate cells of c. Any trailing spaces in the rows of S are removed.

Use the char function to convert back to a string matrix.

Examples

Given the string matrix

S = ['abc '; 'defg'; 'hi  ']

S =
    abc
    defg
    hi

whos S
  Name      Size         Bytes  Class
  S         3x4             24  char array

The following command returns a 3-by-1 cell array.

c = cellstr(S)

c = 
    'abc' 
    'defg'
    'hi'

whos c
  Name      Size         Bytes  Class
  c         3x1            198  cell array

See Also

| | | |

Was this topic helpful?