www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/RemoveTrailingSpacesFromStringArrayExample.m

    %% Remove Trailing Spaces from String Array
% Starting in R2016b, you can create string arrays with the |string|
% function, and remove trailing whitespace with the |deblank| function.
str = string({'Gemini    ','Apollo    ';
              'ISS       ','Skylab    '})
          
%%
newStr = deblank(str)