MATLAB: Character array vs cell array empty cells

cell arraycharacter arrayemptyMATLABtable

I have an array, which is identified by iscell() as a cell array but behaves like a character array:
'jan 7' '2' '' '2.5'
I have 2 questions: 1) why is it not displayed in the console as:
['jan 7'] ['2'] [''] ['2.5']
2) how can i change all [''] cells to [] 3) when trying to create a table with this data I am getting the message: You may have intended to create a table with one row from one or more variables that are character strings. Consider using cell arrays of strings rather than character arrays. Alternatively, create a cell array with one row, and convert that to a table using CELL2TABLE.
Is there a way to convert this array to be easily usable for my table?
Appreciate the help, and I realize this is a pretty basic question but help is appreciated
Thanks,
Will

Best Answer

That's 3 questions ;)
  1. I'm not sure I understand what you mean. If I create a cell array, it displays like this in the command window.
C = { 'jan 7' '2' '' '2.5'}
C =
1×4 cell array
'jan 7' '2' '' '2.5'
which is perfectly normal.
2. I would either create an empty copy of C and move the other values over
D = cell(size(C));
tf = ~ismember(C,'');
D(tf) = C(tf); % this will create an array {'jan 7' '2' [] '2.5'}
or alternatively just remove the cells from C:
C(~ismember(C,'')) = []; % this will create an array {'jan 7' '2' '2.5'}
3. Which function are you trying to use to create the table? If I use
T = cell2table(C);
it works just fine.