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

    %% Remove Leading Whitespace from Character Vector
% Create a character vector with spaces and a tab character as leading
% whitespace.
chr = sprintf('  \t   Remove    leading whitespace')

%%
% Remove the leading tab and spaces.
newChr = strtrim(chr)

%%
% |strtrim| removes the leading whitespace characters, but not the
% whitespace between other characters.