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


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 =

A cellstring will print

c = {'dsadasd'};
c = 

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.

ans =