| MATLAB® | ![]() |
c = cellstr(S)
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.
Given the string matrix
S = ['abc '; 'defg'; 'hi ']
S =
abc
defg
hi
whos S
Name Size Bytes Class
S 3x4 24 char arrayThe following command returns a 3-by-1 cell array.
c = cellstr(S)
c =
'abc'
'defg'
'hi'
whos c
Name Size Bytes Class
c 3x1 294 cell arrayiscellstr, strings, char, isstrprop
![]() | cellplot | cgs | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |