%% Convert Character Array and Remove Trailing Spaces
% Create a character array that contains multiple pieces of text. When a character array contains multiple rows, it is often necessary to pad the array with space characters.

chr = ['Mercury';
       'Apollo ';
       'ISS    ']

%
% Convert chr to a string array. The elements of str include the trailing space characters that padded chr.

str = string(chr)

%
% To remove the trailing spaces, use the deblank function.

newStr = deblank(str)

% Copyright 2012 The MathWorks, Inc.