MATLAB: Question regarding cell to string conversion

cellstrings

Hello all
I have a cell called A which looks like
'E1'
'E34'
'E2'
'E12'
'E17'
'E33'
'E3'
'E11'
'E24'
'E16'
'E19'
'E32'
'E8'
'E35'
'E4'
'E10'
'E21'
'E26'
'E36'
'E15'
'E20'
'E31'
'E14'
'E7'
'E9'
'E37'
'E5'
'E22'
'E25'
'E27'
'E13'
'E30'
'E6'
'E23'
'E28'
'E29'
I want to convert from cell to string but I am not able to do so because of the different lengths each cell element.
Can anyone please guide me through this?
Regards

Best Answer

v={'E1'; 'E34'; 'E2';'E12'}
n=max(cellfun(@numel,v))
w=cellfun(@(x) [x repmat(' ',1,n-numel(x))],v,'un',0)
out=cell2mat(w)
%or simply
out=char(v)