MATLAB Language What you see is NOT what you get: char vs cellstring in the command window


Example

This a basic example aimed at new users. It does not focus on explaining the difference between char and cellstring.


It might happen that you want to get rid of the ' in your strings, although you never added them. In fact, those are artifacts that the command window uses to distinguish between some types.

A string will print

s = 'dsadasd'
s =
dsadasd

A cellstring will print

c = {'dsadasd'};
c = 
    'dsadasd'

Note how the single quotes and the indentation are artifacts to notify us that c is a cellstring rather than a char. The string is in fact contained in the cell, i.e.

c{1}
ans =
dsadasd